Enable Powershell Remoting via Group Policy on Windows7/Windows Server 2008 R2

5

Like I said earlier, I will building my lab soon and I was setting up few important things before I could start the actual labs. So today I have decided to write on enabling Powershell remoting on all the machines in the environment.

You will be able to do so in your environments as well.

Powershell really is a game changer if you're constantly dealing with Microsoft related products, as it is one of the core components which makes management and scripting on Windows a real easy task. One of the important features of Powershell is in its ability to remotely execute scripts on other machines.

Powershell remoting lets you connect to a remote system and run commands locally, then returns the results to the calling machine. This can be done as an automated block or as an interactive session.

Remoting requires Powershell 2.0 which comes default with Windows 7 and Windows Server 2008 R2, other operating systems you have to install separately. The WinRM service will also have to be configured and enabled.

Today I will be showing to enable remoting via group policy.

All of the settings that we will be using in the Group Policy Editor will be of Computer Configuration node.

1. Create a GPO, name it as you want and link to whichever OU to like.
2. Edit the policy.

Enabling WinRM

  1. Browse to:
    Policies > Administrative Templates > Windows Components > Windows Remote Management (WinRM) > WinRM Service

      • Open the “Allow Remote Server management through WinRM” policy setting (Server 2008 R2 and later).
      • Open the “Allow automatic configuration of listeners” policy setting (Server 2008 and earlier).

    Powershell Remoting from Group Policy

  2. Set the Policy to Enabled.
  3. Set the IPv4 and IPv6 filters to * unless you need something specific there (check out the help on the right).

In addition to this, you will have to enable WinRM service to start automatically on the client machines.

To configure the WinRM service to start automatically, navigate to Computer Configuration Policies > Windows Settings > Security Settings > System Services > Windows Remote Management,

Doubleclick on Windows Remote Management and configure the service startup mode to “Automatic”:

Powershell Remoting from Group Policy

Setting the Firewall Rules

You need to create a new Inbound Rule under Computer Configuration > Policies > Windows Settings > Windows Firewall with Advanced Security > Windows Firewall with Advanced Security > Inbound Rules:

Powershell Remoting from Group Policy

The WinRM port numbers are predefined as “Windows Remote Management”:

Powershell Remoting from Group Policy

With WinRM 2.0, the default http listener port changed from TCP 80 to TCP 5985. The old port number are a part of the predefined scope for compatibility reasons, and may be excluded if you don`t have any legacy WinRM 1.1 listeners.

Powershell Remoting from Group Policy

Powershell Remoting from Group Policy

When the rule is created, you may choose to make further restrictions, i.e. to only allow the IP addresses of your management subnet, or perhaps some specific user groups:

Powershell Remoting from Group Policy

Note that this is the minimal configuration that we have done, there is a lot more you can do with the settings, but that is something beyond the scope of this article. Feel free to explore the policy settings.

Wrapping up!

This is all you need to enable remoting via group policy. Now go ahead and apply the policy to the appropriate OUs and start testing. I usually like to remove Authenticated Users from the security filtering and test on different machines before I roll out the policy to production environment.

Happy remoting!

Share.

About Author

I am Adil Arif, working as a Senior Technical Support Engineer at Rubrik as well as an independent blogger and founder of Enterprise Daddy. In my current role, I am supporting infrastructure related to Windows and VMware datacenters.

5 Comments

  1. Hello Adil Arif,

    Great for providing informative topics.
    Have u come across mapped share drives disconnecting after restart in Windows 7 and info regarding this.
    i will be great full.
    Regards,
    Mohan

Leave A Reply