Using the WS-Management protocol we can run a single PowerShell command on one or multiple computers.
However, to use that we need to configure WinRM on target computers to run the command remotely.
The WinRM service runs on port 5985(http) and 5986 (https). Now let’s see how to configure Powershell Remoting on target machines/systems.
Below are the steps to follow
Allow Remote Management Service via GPO
Go to Computer Configuration > Policies > Administrative Templates > Windows Remote Management (WinRM) > WinRM Service
Double click to open following screen
Filtering Example, if you don’t want to allow PS remoting from all machine, and this is a recommended setting from security point of view.
Enable the WinRM service on all systems via GPO
Go to Computer Configuration > Preferences > Control Panel Settings > Services
Right Click > New > Service
Go to recover Tab and configure recover option ( This is optional )
Configure Firewall Rule on all System
Go to Computer Configuration > Policies > Windows Setting > Security Settings > Windows Firewall with Advanced Security.
And right-click Inbound Rules and create a New Rule
Select Predefined and choose Windows Remote Management from the rule list
Un-check public profile
A new rule will be created as below.
Right click the rule in right pane and go to properties > Advanced
And un-check the Private profile
Setting should look like as below
Test the Powershell Remoting
To test the PS Remoting you can run either of the following 2 commands.
For my other Powershell blogs please click following
For more information