-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathenable-rdp.ps1
20 lines (18 loc) · 878 Bytes
/
enable-rdp.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#enable rdp
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name fDenyTSConnections -Type DWord -Value 0
#remove NLA
# NLA (Network Level Authentication)
$NLA = Get-WmiObject -Class Win32_TSGeneralSetting -ComputerName "." -Namespace root\CIMV2\TerminalServices -Authentication PacketPrivacy
#0 disable
#1 enable
$NLA.SetUserAuthenticationRequired(0)
# Recreate the WMI object so we can read out the (hopefully changed) setting
$NLA = Get-WmiObject -Class Win32_TSGeneralSetting -ComputerName "." -Namespace root\CIMV2\TerminalServices -Authentication PacketPrivacy
if ($NLA.UserAuthenticationRequired -eq 0){
Write-Host "NLA setting changed sucessfully"
} else {
Write-Host "Failed to change NLA setting" -ForegroundColor Red
exit
}
# allow RDP on firewall
Enable-NetFirewallRule -DisplayName 'Remote Desktop - User Mode (TCP-in)'