Please note that I'm not only just learning WMI, I'm also just learning VBScript, so I apologize in advance for any inanities that I might utter... I have two .VBS files. The first is "hello.vbs", which consists entirely of the following line: WScript.Echo( "Hello World!" ) The second file, "hello2.vbs", consists of the following lines: Option Explicit Dim System, wmiObject, Return, ProcID Set wmiObject = GetObject("winmgmts:{impersonationLevel=impersonate}!" & _ "SystemName/root/CIMV2:Win32_Process") Return = wmiObject.Create("cscript.exe d:\data\vbscript\hello.vbs", _ Null, Null, ProcID) If Return <> 0 Then WScript.Echo "wmiObject.Create failed - error code:" & Return End If where "SystemName" is the name of a remote Win2K PC. If I understand how this is supposed to work, "hello.vbs" is being run on "SystemName", and in fact, when I run "hello2.vbs", I do not get the error message. However, I also do not see the "Hello World!" message generated by "hello.vbs". What am I doing wrong, or just not understanding?
|