PowerShell Remoting Basics
How do I run PowerShell commands on an authorized remote PC?
Configure WinRM only in a managed trusted environment, then use Test-WSMan and Invoke-Command with explicit computer names.
Use authenticated PowerShell remoting on computers you are authorized to administer.
Follow the steps in order and stop if the screen or target does not match what is described. Use administrator access only when the task requires it.
Confirm authorization
Remote administration requires permission from the system owner and appropriate administrator policy.
Use managed configuration
Configure PowerShell remoting through organizational policy where possible. Avoid broad TrustedHosts entries.
Test WinRM
Test the target's WS-Management endpoint.
Test-WSMan -ComputerName PC-NAMERun a read-only command
Use an explicit computer name and a credential handled by PowerShell's secure prompt.
Invoke-Command -ComputerName PC-NAME -ScriptBlock { Get-ComputerInfo | Select-Object WindowsProductName, WindowsVersion }Close persistent sessions
Remove PSSessions when finished.
Get-PSSession | Remove-PSSessionReview network exposure
Never expose WinRM directly to the public internet. Use firewalls, trusted network boundaries, and current authentication.