Hi,
I have to use a combination of alternative username/password
credentials and remote process creation and fetching its output on
termination. So I can't use the moniker style GetObject as it doesn't
support alternative username.
Am using the following code, but it creates the process, gives me the
PID but when I RDC to that remote machine, I don't see that PID in
the
task manager. What could be wrong? Please help me. The following code
is taken largely from the MSDN link
http://msdn.microsoft.com/en-us/libr...33(VS.85).aspx
--------------*-------------*------------------
Set locator = CreateObject("WbemScripting.SWbemLocator")
Set service = locator.ConnectServer("192.168.1.34","root
\cimv2","Administrator","password")
service.Security_.ImpersonationLevel = 3
Set process = service.Get("Win32_Process")
Set inparams = process.Methods_("Create").InParameters.SpawnInsta nce_
inparams.Properties_.Item("CommandLine") = "Notepad.exe"
Set outparams = process.ExecMethod_("Create",inparams)
If Error = 0 Then
WScript.Echo "Process created with PID of " &
outparams.ProcessId
End If