Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #enable rdp
  2. Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name fDenyTSConnections -Type DWord -Value 0
  3.  
  4. #remove NLA
  5. # NLA (Network Level Authentication)
  6. $NLA = Get-WmiObject -Class Win32_TSGeneralSetting -ComputerName "." -Namespace root\CIMV2\TerminalServices -Authentication PacketPrivacy
  7. #0 disable
  8. #1 enable
  9. $NLA.SetUserAuthenticationRequired(0)
  10. # Recreate the WMI object so we can read out the (hopefully changed) setting
  11. $NLA = Get-WmiObject -Class Win32_TSGeneralSetting -ComputerName "." -Namespace root\CIMV2\TerminalServices -Authentication PacketPrivacy
  12. if ($NLA.UserAuthenticationRequired -eq 0){
  13. Write-Host "NLA setting changed sucessfully"
  14. } else {
  15. Write-Host "Failed to change NLA setting" -ForegroundColor Red
  16. exit
  17. }
  18.  
  19. # allow RDP on firewall
  20. Enable-NetFirewallRule -DisplayName 'Remote Desktop - User Mode (TCP-in)'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement