#PSTip Enabling remote desktop access firewall rules in Windows 8 and Windows Server 2012

Note: This tip requires PowerShell 3.0 or above.

In a couple of earlier posts, we looked at how we can get firewall rules and add new rules. In this post, we shall see an example of extending this knowledge to enable firewall rule for remote desktop access.

There is a built-in firewall rule that needs to enabled for allowing remote desktop access. Make a note that this is not about enabling remote desktop but ensuring that we allow remote desktop access in Windows Firewall.

First, let us see how we can check if the remote desktop firewall rule is enabled:

Get-NetFirewallRule -DisplayName "Remote Desktop*" | Select DisplayName, Enabled

When you run the above command, you will see two firewall rules – “Remote Desktop – User Mode (TCP-In)” and “Remote Desktop – User Mode (UDP-In)”.

We have to enable both these rules to ensure we allow remote desktop access through Windows Firewall.

Get-NetFirewallRule -DisplayName "Remote Desktop*" | Set-NetFirewallRule -enabled true

That is it! You will see that the remote desktop firewall rules are now enabled.

Share on: