You want to connect with remote desktop to a fresh Windows 2012 server (any edition) and you get the “Remote Desktop can’t connect to the remote computer for one of these reasons” generic message that isn’t giving anything except maybe a headache and the will to punch your screen:
For once, the Microsoft-style error message doesn’t totally lack of sense, especially about the last point: “is not available on the network”.
I don’t actually remember how it is with a Server 2008 out of the box, but I don’t remember having had those issues – then again, the guys at work making the templates for our virtual machines in 2008 had perhaps already fixed this…
Anyway, we’re talking here about Windows 2012 (“R1” or R2).
First things first, ensure the remote desktop is enabled. Connect to your machine with the console (VMware/Hyper-V/whatever, or physically to the server if it is … a physical server)
Ensure the following is checked: Control Panel > System and Security > System > Advanced system settings > Remote > Allow remote connections to this computer
This is greyed out here because we activate this through GPO.
Also, note that the checkbox below is NOT checked; this is to allow us to use software such as mRemoteNG (that I strongly advise). In a closed and secure environment, this is OK not to check.
So, Remote connections are allowed but you still get the error message, so there is a firewall issue as you may guess.
Of course you can totally turn the firewall off, but if you’re like me a bit, you don’t like opening all the doors of your home just because someone in your household hasn’t got the key to open one.
So let’s use cool powershell/prompt commands to solve this:
1 |
Get-NetFirewallRule -DisplayGroup "Remote Desktop" | ft Name,Enabled -autosize |
will output the three rules and their current Enabled status. You should see it to “False”
1 |
netsh advfirewall firewall set rule group="remote desktop" new enable=yes |
will open what needs to be opened.
1 |
Get-NetFirewallRule -DisplayGroup "Remote Desktop" | ft Name,Enabled -autosize |
will double check that everything is OK.
The global output should look like this:
Enjoy your remote connection!
Sources & additional info:
- Windows 2012 Core Survival Guide – Firewalls
- How to use the netsh advfirewall firewall (for Win2008 but also valid for 2012)
- There is another blog from which I got the initial PS command, but I don’t find it anymore. My apologies to the author :/
- Remote desktop command for Windows Core