FengShui1998
MIS
Hello,
I'm trying to run a script remotely, but need to know when the script completes before moving on to the next execution in VBScript. Does anyone have any ideas?
Thanks.
fengshui1998
' ****************************************
Function Remote_Cmd(Server, accnt, pwd, strCmd)
' ****************************************
' On Error Resume Next
Set Locator = CreateObject("WbemScripting.SWbemLocator"
Set Service = Locator.ConnectServer(Server, "root\cimv2", accnt, pwd)
Service.Security_.impersonationlevel = 3
Set Process = Service.Get("Win32_Process"
intStatus = Process.Create(strCmd, null, null, intProcessId)
' response.write err.number & " " & err.description
If err.number <> 0 then
Remote_Cmd = err.number & " " & err.description
else
Remote_Cmd = 0
End If
End Function
I'm trying to run a script remotely, but need to know when the script completes before moving on to the next execution in VBScript. Does anyone have any ideas?
Thanks.
fengshui1998
' ****************************************
Function Remote_Cmd(Server, accnt, pwd, strCmd)
' ****************************************
' On Error Resume Next
Set Locator = CreateObject("WbemScripting.SWbemLocator"
Set Service = Locator.ConnectServer(Server, "root\cimv2", accnt, pwd)
Service.Security_.impersonationlevel = 3
Set Process = Service.Get("Win32_Process"
intStatus = Process.Create(strCmd, null, null, intProcessId)
' response.write err.number & " " & err.description
If err.number <> 0 then
Remote_Cmd = err.number & " " & err.description
else
Remote_Cmd = 0
End If
End Function