PowerShell Remoting

  • 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

The Invoke-Command cmdlet is used to run a command on a remote machine. The command looks as follows:
    Invoke-Command -ComputerName COMPUTER -ScriptBlock { COMMAND } -credential USERNAME

Share:

Image Description

Mark Pollard

I am a technical, delivery and engineering leader / Microsoft technologies technical architect, with a strong passion for software engineering. 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 through to its continual and successful running in Production.

All author posts

About

Code Build deploy is a reference site on topics I have found useful, inspired by continuous delivery approaches

Monthly Newsletter

Subscribe to our newsletter and stay up to date with the latest news from mark pollard web!

 

Recent Blog Entries



Contact

Bradford,
West Yorkshire,
United Kingdom

(+44)7912359944