I am trying to run a script (*.vbs) on Server 2003 R2 Std that will send an automated email every time an already scheduled backup completes (successfully or otherwise). I am not having much success as I do not receive an email when the script is ran.
The backup files(*.bkf) themselves are saved to c:\backup when the job completes, if this information helps. Also when setting this up, the information I have looked up goes on about a ntbackuphandler.log file. Do I create this or does the blat software create on completion of script?
The script is written below.
Const strLogDir = "C:\Documents and Settings\administrator\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\"
Const strMailSender = "firstname.lastname@example.org"
Const strMailRecipient = "email@example.com"
Const strBlat = "C:\BackupNotify\full\blat.exe"
Const strBlatLog = "C:\backupnotify\ntbackuphandler.log"
Const strsubject = "Backup report"
Dim fso, WshShell, fldLogs, filLog, strCmd, sFileBuffer, strfail
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fldLogs = fso.GetFolder(strLogDir)
For Each filLog In fldLogs.Files
If DateDiff("n", filLog.DateLastModified, Now) < 5 Then
strCmd = "cmd /c type " & Chr(34) & filLog.Path & Chr(34) & "|" & strBlat & " -subject " & Chr(34) & strsubject & Chr(34) & " -f " & strMailSender & " -to " & strMailRecipient & " -log " & strBlatLog
Set fldLogs = Nothing
Set WshShell = Nothing
Set fso = Nothing
I am a novice when it comes to running & writing scripts (the above script was shamelessly copy and pasted from a script someone else wrote), so the simpler the explanation the better.
Thanks In Advance
Hi, I would ask in the scripting's forum; http://social.technet.microsoft.com/Forums/en-US/ITCG/threads
Or maybe use a .exe like blat.exe to send the email; http://www.blat.net/
- Marked as answer by Zhang QikunMicrosoft contingent staff, Moderator Friday, April 12, 2013 3:18 AM