Created
July 18, 2015 03:30
-
-
Save kikitux/38395cc370a086c9d643 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment