Skip to content

Instantly share code, notes, and snippets.

@hunzo
Last active May 22, 2025 02:34
Show Gist options
  • Save hunzo/c9d90ac73ec0b2cb325ce8bd8b0de0eb to your computer and use it in GitHub Desktop.
Save hunzo/c9d90ac73ec0b2cb325ce8bd8b0de0eb to your computer and use it in GitHub Desktop.
RDP powershell
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value 0
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
New-NetFirewallRule `
-DisplayName "Allow RDP from All Networks (3389)" `
-Direction Inbound `
-Protocol TCP `
-LocalPort 3389 `
-Action Allow `
-Profile Domain,Private,Public `
-EdgeTraversalPolicy Allow
netstat -an | Select-String ":3389"
Get-NetConnectionProfile
Restart-Service -Name TermService -Force
# powershell -ExecutionPolicy Bypass -File .\rdp.ps1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment