- Blog
- /
- PowerShellRemoting
PowerShell Remoting
Windows PowerShell remoting gives you complete control over your Windows system remotely similar to the Linux Shell Terminal with SSH. This is extreamly useful especial when combined with configuration management tools such as Ansible. By default PowerShell remoting is disabled and so it must be enabled and remote machines must be granted access before it can be used.
Enabling access
Using a PowerShell session as Administrator.
- Ensure the WinRM service is running
get-service winrm - Run the WinRM service and enable PowerShell remoting
Enable-PSRemoting –force - Enable users for access
winrm s winrm/config/client '@{TrustedHosts="RemoteComputer"}' - Enable for all remote machines
Set-Item WSMan:\localhost\Client\TrustedHosts * - Restarting the WinRM service
Restart-Service winrm -Force - Checking the status of the WinRM service
winrm quickconfig
Running commands
Invoke-Command -ComputerName COMPUTER -ScriptBlock { COMMAND } -credential USERNAME
Tags:
About the author:
I am a senior software engineering and technical leader / Microsoft technologies technical architect, with a strong passion for continuous delivery. I am a firm believer in empowered teams with true DevOps cultures. I encourage responsibility over role, high quality and full stack engineers, showing ownership of the software and its behaviour, end to end, from requirements maturing all the way through to its continual and successful running in Production.