none
Automated email notification on NTBACKUP will not run

    Question

  • Hi All,

    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 = "backup@somecompany.com"
    Const strMailRecipient = "backups@ourcompany.com"
    Const strBlat = "C:\BackupNotify\full\blat.exe"
    Const strBlatLog = "C:\backupnotify\ntbackuphandler.log"
    Const strsubject = "Backup report"

    Sub Main()
        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
                Wscript.echo strCmd

                WshShell.Run strCmd

            End If
        Next

        Set fldLogs = Nothing
        Set WshShell = Nothing
        Set fso = Nothing
    End Sub

    Main

    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        

    Stephen

                
    Friday, April 05, 2013 12:25 PM

Answers