Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 2.0 » Invoke-Command

Invoke-Command - Powershell 2.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Invoke-Command

Short description
Runs commands on local and remote computers.

Syntax


Description
The Invoke-Command cmdlet runs commands on a local or remote computer and returns all output from the commands, inc
luding errors. With a single Invoke-Command command, you can run commands on multiple computers. 

To run a single command on a remote computer, use the ComputerName parameter. To run a series of related commands t
hat share data, create a PSSession (a persistent connection) on the remote computer, and then use the Session param
eter of Invoke-Command to run the command in the PSSession.

You can also use Invoke-Command on a local computer to evaluate or run a string in a script block as a command. Win
dows PowerShell converts the script block to a command and runs the command immediately in the current scope, inste
ad of just echoing the string at the command line. 

Before using Invoke-Command to run commands on a remote computer, read about_Remote.