Pcornel
Browse topics
Options
Recent
Favorites
Command · Windows / Windows Server / PowerShell

Invoke-Command -ComputerName <computer> -ScriptBlock { <command> }

Invoke-Command -ComputerName <computer> -ScriptBlock { <command> }

Runs a script block on one or more remote computers over PowerShell Remoting (WinRM) and returns the results.

Execution context

Administrator (elevated prompt)

Use when

You need to run the same check or change on several servers.

Privilege Administrator (elevated prompt)State impact Changes stateProduction Unknown

Operational impact: Can change state on the target computers, depending on the script block.
Command detailsSafety model · family · platform · verification · bundle
PrivilegeAdministrator (elevated prompt)
Execution contextAdministrator (elevated prompt)
State impactChanges state
Safe during productionUnknown
CategoryPowerShell
Evidence levelmixed
Primary DomainWindows
Historical technical verificationNeeds verification dateCurrent command content requires review after a Git edit.
Family Ower Hell
PlatformWindows / Windows Server / PowerShell
PrerequisiteAdministrator (elevated prompt)
Output fields

Field glossary

Important fields projected from persisted Command guidance.

output objects with PSComputerName, or errors such as "WinRM cannot complete the operation"

Important persisted output field; use surrounding guidance for interpretation.

Command → Topic semantics

Used in these Topics

Each relation carries both placement role and operational semantic: verifies, configures, troubleshoots, collects evidence, changes state or general.

DomainsWindows

Find another Command

Reference enrichment

Evidence boundary

What this output can establish — and where you must not over-claim.

Proves

Shows the output of the command on each remote computer.

Does not prove

Does not prove the result is the same as running it locally (different profile or rights).

Next check

Test the remote endpoint with Test-WSMan <computer>.

Depth when you need it

Command guidance

Execution context

Administrator (elevated prompt)

Use when

You need to run the same check or change on several servers.

Important fields

output objects with PSComputerName, or errors such as "WinRM cannot complete the operation"

Common problems

WinRM not enabled or blocked by firewall; second-hop credential problem

Operational impact

Can change state on the target computers, depending on the script block.

Technical context

Whether it changes anything depends on the script block. Test with a read-only command first.

Confirmation

Confirm action

Continue?