Created
September 29, 2011 08:20
-
-
Save aero/1250270 to your computer and use it in GitHub Desktop.
Create process via Windows WMI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'How to use -> cscript remote_exe.vbs hostname "cmd /c dir" | |
strComputer = Wscript.Arguments(0) | |
strCommand = Wscript.Arguments(1) | |
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process") | |
errReturn = objWMIService.Create( strCommand , Null, Null, intProcessID ) | |
Select Case errReturn | |
Case 0 WScript.Echo "Command successfully completed " & "Process ID: " & intProcessID | |
Case 2 WScript.Echo "Access Denied" | |
Case 3 WScript.Echo "INsufficient Privilege" | |
Case 8 WScript.Echo "Unknown Failure" | |
Case 9 WScript.Echo "Path not found" | |
Case 21 WScript.Echo "Invalid Parameter" | |
End Select |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment