rhorn
Fri May 21 11:39:54 CDT 2004
"Michael Harris \(MVP\)" <mikhar at mvps dot org> wrote in message news:<uorU#itPEHA.1644@TK2MSFTNGP09.phx.gbl>...
> > I am currently backing the system state on various machines with
> > ntbackup that is launched through a VB script. The script also sends
> > e-mails when its completed. What I need to do is add code that does
> > error checking for when ntbackup fails.Instead of sending an e-mail
> > when it completes I need to change it to send one when it fails. Does
> > anyone have any code out there that does that? Any help would be
> > appreciated.
>
> I would assume the if ntbackup is unsuccessful that the exit code will be
> non-zero...
>
> Google Search: ntbackup errorlevel group:microsoft.*
>
http://groups.google.com/groups?q=ntbackup%20errorlevel%20group:microsoft.*&num=100&scoring=d
>
> Assuming you are using WshShell.Run to execute something like "%comspec% /c
> ntbackup ...", then using true as the 3rd argument of the Run method will
> wait fot completion the the Run method's return value is the ntbackup exit
> code (i.e. the equivalent of %errorlevel% in a bat file).
Below is the code I am using and what I need to do error checking on.
Nothing I have tried as worked
Set objUser = WScript.CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("WScript.Shell")
objName = objUser.GetTempName
objTempFile = objName
objShell.Run "cmd /c C:\Windows\system32\NTBACKUP.exe backup_
\\dfstxfs3\q$\dhcp\backup /v:yes /r:no /rs:no /hc:off /m normal_
/j DFSTXFS3_DHCP_Database_Backup /l:s_
/f c:\DHCP\DHCP_Database_Backup.bkf" ,8,True