PowerShell Remoting Deep Dive
Remoting lets you run commands on remote computers as if you were sitting at them.
How It Works
PowerShell remoting uses WinRM. Commands are serialized to XML, sent over HTTP (port 5985) or HTTPS (port 5986), executed remotely, and results returned.
Setup
Enable-PSRemoting -Force Get-Service WinRM Test-WSMan -ComputerName Server01
One-to-Many
$servers = Get-Content servers.txt
Invoke-Command -ComputerName $servers -ScriptBlock { Get-PSDrive C }Sessions
$session = New-PSSession -ComputerName Server01
Invoke-Command -Session $session -ScriptBlock { Get-Service }
Remove-PSSession $session