In this cool article, I’ll show you how to enable Remote Desktop using Windows PowerShell on Windows Server 2016 and 2012.
I know that there are many ways to enable Remote Desktop on Windows Server like Group Policy, WDS Image and manually, however, you might need to do this on a new Server build as part of a string of scripts.
In order to get this done, I’ll use two cmdlets, The first will enable remote desktop and the second will open the Firewall In case it’s on.
To get started, run the two lines below and you are done.
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name "fdenyTSXonnections" -Value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"