eagleshi 发表于 2018-9-15 10:59:52

Enable and Disable RDP NLA using PowerShell

#Powershell script to enable Network Level Authentication for Remote Desktop Services Connections  #The need arose when trying to RDP using a third party application and it gave the following error:
  #The remote computer '' requires Network Level Authentication, which your computer does not support.
  # The following script has to be run on the remote machine using RDC (Remote Desktop Connection) on which you are attempting to RDP to and gives the error.
  # Post that you should be able to successfully run RDP using the third party application.
  # Comparative .reg script is as below:
  # Windows Registry Editor Version 5.00
  #
  # "UserAuthentication"=dword:00000000
  # "SecurityLayer"=dword:00000000
  # Author - Vikram Bedi
  # vikram.bedi.it@gmail.com
  #Powershell v2.0
  #v1.0 Initial Script
  $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
  $Name1 = "UserAuthentication"
  $value1 = "00000000"
  IF(!(Test-Path $registryPath))
  {
  New-Item -Path $registryPath -Force | Out-Null
  New-ItemProperty -Path $registryPath -Name $name1 -Value $value1 -PropertyType DWORD -Force | Out-Null
  }
  ELSE
  {
  New-ItemProperty -Path $registryPath -Name $name1 -Value $value1 -PropertyType DWORD -Force | Out-Null
  }
  $Name2 = "SecurityLayer"
  $value2 = "00000000"
  IF(!(Test-Path $registryPath))
  {
  New-Item -Path $registryPath -Force | Out-Null
  New-ItemProperty -Path $registryPath -Name $name2 -Value $value2 -PropertyType DWORD -Force | Out-Null
  }
  ELSE
  {
  New-ItemProperty -Path $registryPath -Name $name2 -Value $value2 -PropertyType DWORD -Force | Out-Null
  }

页: [1]
查看完整版本: Enable and Disable RDP NLA using PowerShell