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
Else
Wscript.Echo "notepad.exe could not be started due to error: " & errReturn
End If

__________

Comments

Popular posts from this blog

Assigning Windows 10/11 Enterprise Subscription Activation Licences to Hybrid Azure AD Joined Devices

Autopilot Hybrid Azure AD Join with Customised First Login Status

Upgrade Samsung Galaxy Ace 2 (I8160) to Android Jelly Bean