How to pass arguments for remote commands

When invoking remote commands, one often wants to use local values as arguments to the remote command. This post explains how to do that. Hardcoded values Let's start with a simple example. Below you can see how Get-Process is invoked in a remote session when the Id parameter is set to 0: PS> $s = New-PSSession -Computer localhost PS> Invoke-Command -Session $s -Script { Get-Process -Id 0 Read More...

Read the complete post at

Posted Dec 29 2009, 02:57 PM by Windows PowerShell Blog
Filed under:
Copyright 2012 All rights reserved.