Establishing Remote Sessions
Windows PowerShell 2.0 supports both local and remote sessions. A session is a runspace that establishes a common working environment for commands. Commands in a session can share data. Although you’ll learn more about sessions in upcoming chapters, let’s look now at how remote sessions are used.
You can establish a local or remote session to create a persistent connection using the New-PSSession cmdlet. Unless you use the –ComputerName parameter and use it to specify the name of one or more remote computers, PowerShell assumes you are creating a session for the local computer. With New-PSSession, you must use the –Session parameter with Invoke-Command to run the command in the named session. For example, ...