2008 scheduled backup notifications Printed from: Macrium Support Forum Topic: Topic author: dniesen
Subject: 2008 scheduled backup notifications I have installed the latest Macrium evaluation on a Windows 2008 server and backup/restore is working beautifully. I have successfully created a VBS script to perform the backup and send email notifications with the log on completion.
Replies:
Reply author: Nick Hi dniesen
Reply author: dniesen Strangely, no. Just the "successful backup" event generated from Reflect.
Reply author: dniesen This does seem to email while logged into the console, but if nobody is logged in, no email are sent out.
Reply author: Nick Hi
Reply author: dniesen Can't I only do email notifications when running a VB script?
Reply author: bplate We are experiencing the same issue on Windows 2008 Standard 64-bit SP2 and R2. Both servers are part of a workgroup.
Reply author: bplate Below is a screen shot of my taskmanager with the Command Line column turned on. This shows that it is still running the VBS files.
Reply author: bplate Last night I logged into the server via RDP and detatched (left the administrator logged in). The script ran fine, emailed and the wscript.exe process isn't listed in the taskmanager. Bruce
Reply author: dniesen
quote: This is exactly what I've seen. Only if there's someone logged into the console or on a detached RDP session will we receive an email. I've been leaving myself logged into the console with the screen locked for now but it's not an ideal situation.
Reply author: john.p Sorry to hear you are having problems. We can't currently recreate the problem. '****************************************************************************** '* Sub: LogError '* '* Purpose: Reports errors. '* '* Input: None '* Output: None '* '****************************************************************************** Sub LogError Dim strLogFileName Dim objFS, objNewFile If Err <> 0 Then strLogFileName = "<VBS file location>\errorlog-" & Year(Date) & "-" & Month(Date) & "-" & Day(Date) & " " & Hour(Time) & "." & Minute(Time) & "." & Second(Time) & ".txt" Set objFS = CreateObject("Scripting.FileSystemObject") Set objNewFile = objFS.OpenTextFile(strLogFileName , 8, true) objNewFile.WriteLine "Error: : " & Err objNewFile.WriteLine "Error (hex) : 0x" & Hex(Err) objNewFile.WriteLine "Source : " & Err.Source objNewFile.WriteLine "Description : " & Err.Description Err.Clear objNewFile.Close set objFS = nothing End If End SubThen, the next time an email send fails, you will find an error log file in <VBS file location> titled errorlog-<date>.txt.log Once you see such a file, could you send it to support(at)macrium.com or paste the contents into this thread. Hopefully, then we can get to the bottom of your problem. Kind Regards John - Macrium Support
Reply author: bplate Sorry for the delay. I added the code, but it appears it is hanging before it even gets to the email function.
Reply author: john.p Hi, '****************************************************************************** '* Function: Backup '* '* Purpose: Calls Reflect.exe passing an XML BDF as a parameter '* Optionaly logs output to file '* '* Input: strCmdLine Command Line Arguments '* Output: Exit Code '* '****************************************************************************** Function Backup(Byref strCmdLine) Dim objShell Dim objExecObject Dim strLine Dim objFS Dim objNewFile Dim strLogFileName LogLine("Starting backup") ' Run the backup or image Set objShell = WScript.CreateObject("WScript.Shell") LogLine("Executing Reflect") Set objExecObject = objShell.Exec(strCmdLine) LogLine("Executed Reflect") ' Log to file LogLine("Create log") strLogFileName = "<vbs files location>\Reflect\log-" & Year(Date) & "-" & Month(Date) & "-" & Day(Date) & " " & Hour(Time) & "." & Minute(Time) & "." & Second(Time) & ".txt" Set objFS = CreateObject("Scripting.FileSystemObject") Set objNewFile = objFS.OpenTextFile(strLogFileName , 8, 1) Do Until objExecObject.StdOut.AtEndOfStream strLine = objExecObject.StdOut.ReadLine() If Instr(strLine , "%") = 0 Then objNewFile.WriteLine strLine end if Loop LogLine("Close log") objNewFile.Close set objFS = nothing ' Wait for the process to finish LogLine("Wait for Reflect to finish") Do While objExecObject.Status = 0 WScript.Sleep 100 Loop LogLine("Reflect finished exit code = " & objExecObject.exitcode) if objExecObject.exitcode = 2 then ' Handle XML validation error LogLine("Reflect xml validation error") elseif objExecObject.exitcode = 1 then LogLine("Reflect backup error - send failed mail") ' Handle backup error SendEmail "Macrium Reflect - Backup Failed", "A failed backup", strLogFileName objShell.LogEvent 1, "Macrium Reflect - Backup Failed" LogLine("Reflect backup error - sent failed mail") elseif objExecObject.exitcode = 0 then ' Everything OK LogLine("Reflect backup error - send success mail") objShell.LogEvent 0, "Macrium Reflect - Successful Backup" SendEmail "Macrium Reflect - Successful Backup", "A successful backup", strLogFileName LogLine("Reflect backup error - sent success mail") end if Backup = objExecObject.exitcode Set objExecObject = nothing Set objShell = nothing End Function Replace the line objMessage.Send in the SendEmail function with On Error Resume Next 'trap CDO errors LogLine("About to do CDO send mail") objMessage.Send LogError On Error goto 0 'cancel On Error LogLine("Done with CDO send mail") and past these two functions at the end of your script, replacing <log file location> with a writeable path of your preference. '****************************************************************************** '* Sub: LogLine '* '* Purpose: Logs lines. '* '* Input: Line to log '* Output: None '* '****************************************************************************** Sub LogLine(line) Dim strLogFileName Dim objFS, logFileObj, objNewFile strLogFileName = "<log file location>\errorlog.txt" Set objFS = CreateObject("Scripting.FileSystemObject") Set objNewFile = objFS.OpenTextFile(strLogFileName , 8, 1) objNewFile.WriteLine Year(Date) & "-" & Month(Date) & "-" & Day(Date) & " " & Hour(Time) & "." & Minute(Time) & "." & Second(Time) & " - " & line objNewFile.Close set objFS = nothing End Sub '****************************************************************************** '* Sub: LogError '* '* Purpose: Reports errors. '* '* Input: None '* Output: None '* '****************************************************************************** Sub LogError Dim line line = "Error: : " & Err line = line & " Error (hex) : 0x" & Hex(Err) line = line & " Source : " & Err.Source line = line & " Description : " & Err.Description If Err <> 0 Then Err.Clear End If LogLine(line) End Sub Hopefully, this time we can see where it is hanging. When you noted the wscript task in the taskmanager - did you notice a reflect task too? Kind regards, Kind Regards John - Macrium Support
Reply author: bplate Okay. I'll give it a shot later.
Reply author: amherst Having the same problem here, with W2008 x64
Reply author: SilvrDrgn This is very similar to the problem I am having. I've got four licenses and the lastest version of Reflect (updated within the past week). It's installed on four Windows 7 Home Premium 64-bit PCs in my house. All of them are set up to use a separate account called "Services" for running background services and jobs. That account is in the Administrators group and is granted login/logon as a service right, but it is never interactively logged in. Using the Reflect UI under my own login account (not "Services" listed above), the standard VBS file generated by Reflect can send its Email status message when I run the VBS file manually. However, the automatic job which runs under the "Services" ID does run successfully, but it does not send out the Email message. Please advise.
Reply author: john.p Hi SilvrDrgn,
Reply author: Nick Hi ' Elevate this script for Admin privileges in Vista ElevateIt appears that the 'User Profile Hive Cleanup Service' is incorrectly closing required registry keys for both Reflect and WScript if the VBScript is scheduled and elevated at run time. When scheduling VBScript source it isn't necessary to elevate so this function isn't required. Hope this helps Nick - Macrium Support
Reply author: SilvrDrgn
quote: I have made the change to the VBScript on all four machines. The backups will not run again until tonight. So, I will report back here tomorrow if I received the Email notifications or not. If I don't, then I will investigate the Windows application event log for issues as John suggested.
Reply author: SilvrDrgn
quote: Good news! After commenting out the "Elevate" call and letting the backups run normally last night, I received the Email notifications from three out of four of my systems. The fourth system encountered a problem not related to Macrium, so the backup did not run. I think it's safe to say that my issue with the Email notifications is resolved. Thanks a lot! Macrium Support Forum : http://support.macrium.com/ © Paramount Software UK Ltd |