S
satv73
Hi everybody,
I am facing a problem with remote execution. The following is my
scenario:
1) Machine_A tries to connect to Machine_B via WMI and execute
\\Machine_C\share\application.exe
2) The credentials that I use to connect to Machine B has enough rights
to
access MachineC's Share.
I am using the following code:
Const SW_NORMAL = 1
strComputer = "MACHINE_B"
strCommand = \\MACHINE_C\Share\Application.exe
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objLocator.ConnectServer(strComputer,"root\cimv2",
"mydomain\userX","mypass")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = SW_NORMAL
Set objProcess = objWMIService.Get("Win32_Process")
intReturn = objProcess.Create _
(strCommand, Null, objConfig, intProcessID)
If intReturn <> 0 Then
Wscript.Echo "Process could not be created." & _
vbNewLine & "Command line: " & strCommand & _
vbNewLine & "Return value: " & intReturn
Else
Wscript.Echo "Process created." & _
vbNewLine & "Command line: " & strCommand & _
vbNewLine & "Process ID: " & intProcessID
End If
I always get the following output:
Process could not be created.
Command line: \\Machine_C\Share\Application.exe
Return value: 2
[But remote execution of local executable on Machine_B always works]
Please let me know what is wrong.
Thanks
Sathish
I am facing a problem with remote execution. The following is my
scenario:
1) Machine_A tries to connect to Machine_B via WMI and execute
\\Machine_C\share\application.exe
2) The credentials that I use to connect to Machine B has enough rights
to
access MachineC's Share.
I am using the following code:
Const SW_NORMAL = 1
strComputer = "MACHINE_B"
strCommand = \\MACHINE_C\Share\Application.exe
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objLocator.ConnectServer(strComputer,"root\cimv2",
"mydomain\userX","mypass")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = SW_NORMAL
Set objProcess = objWMIService.Get("Win32_Process")
intReturn = objProcess.Create _
(strCommand, Null, objConfig, intProcessID)
If intReturn <> 0 Then
Wscript.Echo "Process could not be created." & _
vbNewLine & "Command line: " & strCommand & _
vbNewLine & "Return value: " & intReturn
Else
Wscript.Echo "Process created." & _
vbNewLine & "Command line: " & strCommand & _
vbNewLine & "Process ID: " & intProcessID
End If
I always get the following output:
Process could not be created.
Command line: \\Machine_C\Share\Application.exe
Return value: 2
[But remote execution of local executable on Machine_B always works]
Please let me know what is wrong.
Thanks
Sathish