How to Enable or Disable RDP NLA from PowerShell Windows Server 2016/2019/2022

By default, you might find RDP firewall rules disabled, which prevent RDP connections to the server. To enable preset firewall rules of RemoteDesktop, use the following PowerShell command:

Enable-NetFirewallRule -DisplayGroup ‘Remote Desktop’

or from CMD, append powershell.exe in the beginning:

powershell.exe Enable-NetFirewallRule -DisplayGroup ‘Remote Desktop’

To disable RDP Network Level Authentication (NLA), use the following PowerShell command:

Set-ItemProperty ‘HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\’ -Name “UserAuthentication” -value 0

or from CMD, append powershell.exe in the beginning:

powershell.exe Set-ItemProperty ‘HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\’ -Name “UserAuthentication” -value 0

If RDP is disabled from the settings, you can enable RDP using the following PowerShell command:

Set-ItemProperty -Path ‘HKLM:\System\CurrentControlSet\Control\Terminal Server’ -name “fDenyTSConnections” -value 0

Ref: Enable RDP Firewall rules and disable RDP NLA from PowerShell Windows Server 2016/2019 – XO Techy