dcandygmailcom

Starts a program on a remote computer using WMI

Feb 8th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'CreateRemoteProcess.vbs
  2. 'Starts a program on a remote computer using WMI.
  3. 'Programs started on remote computers are invisible on that computer unlike programs started locally
  4. ComputerName = "127.0.0.1"
  5. Set objWMIService = GetObject("winmgmts:\\" & ComputerName & "\root\cimv2")
  6. Set objProcess = objWMIService.Get("Win32_Process")
  7. intReturn = objProcess.Create("c:\windows\notepad", Null, objConfig, intProcessID)
  8. If intReturn = 0 then
  9.     wscript.echo "PID is " & intProcessID
  10. Else
  11.     Msg = "Error code " & intReturn & vbcrlf & vbcrlf
  12.     Msg = Msg & "2   Access denied" & vbcrlf
  13.     Msg = Msg & "3   Insufficient privilege" & vbcrlf
  14.     Msg = Msg & "8   Unknown failure" & vbcrlf
  15.     Msg = Msg & "9   Path not found" & vbcrlf
  16.     Msg = Msg & "21  Invalid parameter"
  17.     wscript.echo Msg
  18. End If
Advertisement
Add Comment
Please, Sign In to add comment