Put the script inside a .vbs file
change the "changeme" parts as for your system (backup path to watch in, admin password)
check hmailserver console for backup path existing from backup function
schedule this vbs on host task schedule manager
et voilĂ !
works in 4.x and 5.x
Code:
Dim Fso
Dim Directory
Dim Modified
Dim Files
' search for backupfiles older than days
' delete them
' fires a new backup
' change me !
Const sAdminPassword = "<hmailadmin_password_put_here>"
strLogFIleSuffix = ".zip"
' change me !
strPath = "C:\the_path_for_backup_destination"
' days old to retain zips
intDaysOld = 3
Set Fso = CreateObject("Scripting.FileSystemObject")
Set Directory = Fso.GetFolder(strPath)
Set Files = Directory.Files
For Each Modified in Files
If DateDiff("D", Modified.DateLastModified, Now) > intDaysOld and lcase(right(Modified,4))=strLogFIleSuffix Then
Modified.Delete
' just debug purpouse
' WScript.Echo(" Will delete " & Modified.Name)
end if
Next
' This scripts creates a hMailServer backup using the settings
' specified in hMailAdmin. You can double-click on the file to
' run the script.
'
' To use the script you need to update the sAdminPassword
' setting below to reflect your own hMailServer Administrator
' password. If you want to run automatic backups, please
' start this script using Windows Scheduled Tasks.
'
Dim oApp
Set oApp = CreateObject("hMailServer.Application")
' Authenticate the client.
Call oApp.Authenticate ("Administrator", sAdminPassword)
Call oApp.BackupManager.StartBackup()