Dim objCmd
Dim strReturn
Dim strCommand
Dim strError
strCommand = "msdeploy -verb:sync -source:webServer,computerName=xxxx -dest:webServer,computerName=yyyy -replace:objectName=binding,targetAttributeName=bindingInformation,match=xx\.xx\.xx\.xx,replace=xx.xx.xx.xx -whatif -verbose > D:\xxxx\Sync-IIS.log"
set objShell = CreateObject("Wscript.Shell")
set objProc = objShell.Exec(strCommand)
Do While objProc.Status = 0
WScript.Sleep 10000
Loop
If objProc.ExitCode <> 0 then
strError = "Error running command: " & strCommand & " (Exit Code: " & objProc.ExitCode & ")" & VbCrLf & VbCrLf & "Check logs in xxxx"
sendErrormail strError (caling a sending email function)
WScript.Echo "Sending Error mail"
ElseIf Err.Number <> 0 Then
strError = "Error running command: " & strCommand & VbCrLf & VbCrLf & "Error Number: " & Err.Number & ". Error Description: " & Err.Description
sendErrormail strError (caling a sending email function)
WScript.Echo "Sending Error mail"
End if
Set objCmd = Nothing
-----------------------------------------------------------------------------
Thanks for your help
RW