Running a process on a remote machine SILENTLY

Below is the contents of a script to run a process on a remote workstation.

It will only run the program silently in the background. As you can't interact this is obviously only recommended to be run on processes which don't require any interaction.

The process will run as the user you run the VBS script as, on the workstation specified in the script.


strComputer = "remotecomputername"
strCommand = "notepad.exe"

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objProcess = objWMIService.Get("Win32_Process")

errReturn = objProcess.Create(strCommand, null, null, intProcessID)

If errReturn = 0 Then
Wscript.Echo "notepad.exe was started with a process ID: " & intProcessID
Wscript.Echo "notepad.exe could not be started due to error: " & errReturn
End If



Popular Posts