Created: 8/30/20

Updated: 8/30/20

You ever have that moment when you deploy a physical server only to find you forgot to enable RDP on the server? – I admittedly did this recently, but thankfully I knew I could use Powershell to remotely administer the server and enable RDP.

Below are the command you’d need to run in order to get this working:

#Enter Powershell session of Remote Server
Enter-PSSession Server1.companyA.local

#Enable RDP
Set-ItemProperty -Path “HKLM:\System\CurrentControlSet\Control\Terminal Server” -Name “fDenyTSConnections” –Value 0

#Enabling the Firewall Rule for RDP in the Firewall
Enable-NetFirewallRule -DisplayGroup “Remote Desktop”

#Enable Authentication via RDP
Set-ItemProperty -Path ‘HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp’ -name “UserAuthentication” -Value 1

#Disabled Domain Profile Firewall
netsh advfirewall set domainprofile state off

#Disable Private Profile Firewall
netsh advfirewall set privateprofile state off

#Disable Public Profile Firewall
netsh advfirewall set publicprofile state off

#Disable All profile Firewalls
netsh advfirewall set allprofiles state off

#Test Connection of RDP – aka port 3389
Test-NetConnection -ComputerName Server1.companyA.local -port 3389

#########
# RARE #
#########

Set-ItemProperty -Path ‘HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters’ -name “AllowEncryptionOracle” 2 -Type DWord

Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False