Print Page | Close Window

2008 scheduled backup notifications

Printed from: Macrium Support Forum
Topic URL: http://support.macrium.com/topic.asp?TOPIC_ID=1067
Printed on: April 01 2025

Topic:


Topic author: dniesen
Subject: 2008 scheduled backup notifications
Posted on: February 27 2009 09:37:19
Message:

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.

The weird issue I'm having is that running this VBS script manually produces the expected notification email. However the scheduled task that runs each morning does not. The task is scheduled as the same user that runs it manually and the scheduled task does run successfully and create a log file.

The only difference I can think of is that I'm not logged in when the scheduled task is running, but this same configuration works fine on a Windows 2003 server.

Any ideas what might be causing this?

Replies:


Reply author: Nick
Replied on: February 27 2009 10:12:21
Message:

Hi dniesen

Are there any clues in the Windows Event log?

Kind Regards

Nick - Macrium Support



Reply author: dniesen
Replied on: February 27 2009 11:04:47
Message:

Strangely, no. Just the "successful backup" event generated from Reflect.

For now, I'm leaving myself logged into the console (locked) to see if that will generate the email. While logged in and running the scheduled task, it does generate the email. It seems to only be only when the task is run on that schedule and possibly when I'm not logged in.

I'll find out tomorrow morning if it emails while logged into the console.


Reply author: dniesen
Replied on: March 10 2009 12:30:56
Message:

This does seem to email while logged into the console, but if nobody is logged in, no email are sent out.

There doesn't seem to be anything fishy showing up in the event log (just the success/failed events).

It only seems to be happening on our 2008 server, the XP and 2003 server are firing off each morning whether or not I'm logged in.


Reply author: Nick
Replied on: March 10 2009 14:01:14
Message:

Hi

We've just confirmed that Server 2008 Enterprise can send email notifications from Reflect scheduled tasks without any user logged on.

It may be a security issue. Can you try scheduling the task as the local 'Administrator' user?

You can also enter a scheduled task directly into the Server 2008 task scheduler. Run program: 'c:\program files\macrium\reflect\reflect.exe' with parameters '-e -w <path to XML file>'.

Hope this helps


Nick - Macrium Support



Reply author: dniesen
Replied on: March 10 2009 14:14:14
Message:

Can't I only do email notifications when running a VB script?

I believe manually scheduling and specifying the XML file will just cause the backup to run.

This is Windows Server 2008 Web Server edition, if that makes any difference. The user I'm running it as is an administrator, but I can try scheduling it as the local Administrator to see what happens.


Reply author: bplate
Replied on: March 15 2010 15:42:12
Message:

We are experiencing the same issue on Windows 2008 Standard 64-bit SP2 and R2. Both servers are part of a workgroup.

Event Log shows - " Macrium Reflect - Successful Backup " and the backup image files seems fine.

However, taskmanager is still showing a wscript.exe and each night I see another running wscript.exe until I kill them off or restart the box.

Bruce

Case Partners, Inc
Sr. Systems Engineer


Reply author: bplate
Replied on: March 15 2010 15:53:21
Message:

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.




Also, I can run the VBS logged in locally and it will email.

The only major tweak I made was adding the following line so that I could use port 2525 on the mail server.

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=2525


Bruce


Case Partners, Inc
Sr. Systems Engineer


Reply author: bplate
Replied on: March 16 2010 11:47:04
Message:

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

Case Partners, Inc
Sr. Systems Engineer


Reply author: dniesen
Replied on: March 16 2010 11:49:26
Message:

quote:
Originally posted by 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

Case Partners, Inc
Sr. Systems Engineer



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
Replied on: March 16 2010 13:59:21
Message:

Sorry to hear you are having problems. We can't currently recreate the problem.

To diagnose what is going on, it would be really helpful if you could add some error checking to your vbscript.

Could you locate the line in your vbs file, in the SendEmail function, that reads

objMessage.Send

And modify it so that it looks like this ...


On Error Resume Next 'trap CDO errors
objMessage.Send
LogError
On Error goto 0 'cancel On Error


And add this to the end of your script. Note that you will need to insert the location of your vbs files in place of <VBS file location>. Typically this will be something like C:\Users\<USER>\Documents\Reflect where <USER> is your user name.

'******************************************************************************
'* 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 Sub
Then, 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
Replied on: March 23 2010 11:49:56
Message:

Sorry for the delay. I added the code, but it appears it is hanging before it even gets to the email function.

Do you have any recommendations on enabling more debugging logic? I was going to put in some logic to log before each line in the script, but I don't want to repeat any work that you may have already created.

Also, as I said earlier, both of the systems I'm having trouble with are 2008 64-bit. They are Hyper-V VMs too. I went back to the original image on my test system of the 2008 VM and Macrium emails as expected.

Bruce

Case Partners, Inc
Sr. Systems Engineer


Reply author: john.p
Replied on: March 23 2010 14:27:07
Message:

Hi,

Thanks for try that out. As you say, we need more debugging logic. There is not that much that can fail between the reflect call (which appears to work) and the CDO send email step which is not being reached.

Here goes - bit more complex this time. The instructions are for a script as generated by the reflect vbscript generator. Feel free to place calls to LogLines wherever else you think appropriate.

Paste this in place of your backup function (change the email messages if that bothers you)

Replace <vbs files location> with the path to your vbs files.

'******************************************************************************
'* 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
Replied on: March 24 2010 12:31:08
Message:

Okay. I'll give it a shot later.

Case Partners, Inc
Sr. Systems Engineer


Reply author: amherst
Replied on: April 11 2010 23:08:24
Message:

Having the same problem here, with W2008 x64

However, one possible "differential".

We have two identical machines, one with Exchange (and is an AD controller) and the other without exchange as a member server. The problem we're having is with the AD/exchange box....as the other server runs sweet.

Gonna have another play and come back...


Reply author: SilvrDrgn
Replied on: April 14 2010 14:25:26
Message:

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
Replied on: April 14 2010 16:44:36
Message:

Hi SilvrDrgn,

Would it be possible for you to check the windows application event log? Can you see any Warning level entries occurring at or about the time when the backup ends ,raised by the User Profile service and with the following message?


Windows detected your registry file is still in use by other applications or services. The file will be unloaded now. The applications or services that hold your registry file may not function properly afterwards.

DETAIL - ....


Typically this will then go on to list keys from reflect.exe and wscript.exe.

Kind Regards
John - Macrium Support


Reply author: Nick
Replied on: April 15 2010 10:24:30
Message:

Hi

We have a solution for this problem.

Modify the VBScript source and either delete or comment out the code 'Elevate'

' Elevate this script for Admin privileges in Vista
	Elevate
It 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
Replied on: April 15 2010 14:07:02
Message:

quote:
Originally posted by Nick

Hi

We have a solution for this problem.

Modify the VBScript source and either delete or comment out the code 'Elevate'
' Elevate this script for Admin privileges in Vista
	Elevate
It 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





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
Replied on: April 16 2010 12:34:16
Message:

quote:
Originally posted by Nick

Hi

We have a solution for this problem.

Modify the VBScript source and either delete or comment out the code 'Elevate'
' Elevate this script for Admin privileges in Vista
	Elevate
It 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



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

Close Window