Invoke-Command
CautionRun commands remotely
Invoke-Command -ComputerName <host> -ScriptBlock {...}
Fan-out execution over WinRM — audit or configure many servers at once (needs PSRemoting).
Examples
Invoke-Command -ComputerName srv01,srv02 -ScriptBlock { Get-Service spooler }Check a service on many hosts
Syntax
Invoke-Command -ComputerName <hosts> -ScriptBlock {cmd}
Before you run it
Mass execution means mass impact.
Related commands
- Enter-PSSessionInteractive remote session
- sshRemote shell
The same reference, with no signal at all
Every command and flow from this site, held on your device and searchable with no connection. Free to install, no ads.
Get it free on the App Store