This cmdlet is part of the Vexasoft Cmdlet Library. You can download it now or click here to find out more.

Start-RemoteProcess

Synopsis

Start a program or executable on a remote computer.

Syntax

  • Start-RemoteProcess [-CommandLine] [-ComputerName] [-Credential]

Description

Start-RemoteProcess is used to start executables on remote computers. It is similar to the built-in Start-Process cmdlet, but can also be used against remote machines.

The remote process will run in the context of the current user or a user specified using the credential parameter. Remote processes run in a separate non-interactive session and are not visible to desktop users.

Start-RemoteProcess can be used in conjunction with Copy-ToTemp to copy and execute programs on remote computers in a single command line.

Parameters

  • CommandLine The command line and any command line arguments for the process.
  • ComputerName The computer on which to start the process.
  • Credential The credentials to use to start the process.

Inputs

Start-RemoteProcess accepts the output of Copy-ToTemp as an input object and will execute the copied on the remote computer.

Outputs

Start-RemoteProcess does not output any PowerShell objects.

Notes

The cmdlet requires that the Remote Registry and RPC services are started on the computer it is trying to access and that DNS services are available to resolve target host names.

Example 1

This command will execute the batch file c:\scripts\myscript.bat on the remote computer server01:

C:\PS>Start-RemoteProcess c:\scripts\myscript.bat -computer server01

Example 2

This command will start notepad.exe on the remote computer Win7PC. However, the process will start in a non-interactive session and will not be visible on the desktop of anyone using the PC:

C:\PS>Start-RemoteProcess Notepad.exe -Computer Win7PC

Example 3

Start-RemoteProcess can work in conjunction with Copy-ToTemp. This command will copy the executable beep.exe to remote computer pc01 and run it on the remote computer.:

C:\PS>Copy-ToTemp c:\MyProgram\beep.exe -Computer pc01 | Start-RemoteProcess