Enabling Remote Desktop and Opening the Firewall Port with PowerShell
Turning on Remote Desktop from the GUI is fine for a one-off machine, but if you’re setting up a server (especially Server Core, where there’s no GUI to click through) doing it via PowerShell is quicker and scriptable across multiple machines.
First, enable Remote Desktop itself by flipping the fDenyTSConnections registry value:
Set-ItemProperty -Path 'HKLM:SystemCurrentControlSetControlTerminal Server' -Name "fDenyTSConnections" -Value 0
Then make sure the Windows Firewall rule group for Remote Desktop is enabled so the traffic is actually allowed through:
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
Run both from an elevated PowerShell session. Once complete, you should be able to connect over RDP immediately — no reboot required for either change. If you also want to require Network Level Authentication (recommended for anything internet-facing), that’s a separate property:
Set-ItemProperty -Path 'HKLM:SystemCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp' -Name "UserAuthentication" -Value 1
Resources
Gear We Recommend
Firewall rules are only half the story. Here’s the networking hardware we recommend for a properly segmented setup.
Browse our Networking Equipment picks on AmazonAs an Amazon Associate, TechyGeeksHome earns from qualifying purchases.
Discover more from TechyGeeksHome
Subscribe to get the latest posts sent to your email.
” Enable-NetFirewallRule -DisplayGroup “Remote Desktop” ”
How enable this is use only domain?
You could use a Get and then Enable method. So you could try something like this:
Get-NetFirewallRule | Where {$.DisplayGroup -eq “Remote Desktop” -and $.Profile -eq “Domain”} | Enable-NetFirewallRule
Will it work on Workgroup Computers or only domain joined?
Hi – yes it should work on workgroup computers too.
” Enable-NetFirewallRule -DisplayGroup “Remote Desktop” ”
How enable this is use only domain?
You could use a Get and then Enable method. So you could try something like this:
Get-NetFirewallRule | Where {$_.DisplayGroup -eq “Remote Desktop” -and $_.Profile -eq “Domain”} | Enable-NetFirewallRule
” Enable-NetFirewallRule -DisplayGroup “Remote Desktop” ”
How enable this is use only domain?
You could use a Get and then Enable method. So you could try something like this:
Get-NetFirewallRule | Where {$_.DisplayGroup -eq “Remote Desktop” -and $_.Profile -eq “Domain”} | Enable-NetFirewallRule
Will it work on Workgroup Computers or only domain joined?
Hi – yes it should work on workgroup computers too.
Will it work on Workgroup Computers or only domain joined?
Hi – yes it should work on workgroup computers too.