加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

Enable and Disable RDP NLA using PowerShell

发布时间:2020-12-13 21:12:03 所属栏目:Windows 来源:网络整理
导读:Enable_RDP_NLA #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 'machin

Enable_RDP_NLA

#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 '<machine name>' 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

# [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp]
# "UserAuthentication"=dword:00000000
# "SecurityLayer"=dword:00000000

# Author - Vikram Bedi 
# vikram.bedi.it@gmail.com 

#Powershell v2.0
#v1.0 Initial Script

$registryPath = "HKLM:SYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp"

$Name1 = "UserAuthentication"
$value1 = "00000001"
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 = "00000001"
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
  }

Disable_RDP_NLA

#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 '<machine name>' 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

# [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp]
# "UserAuthentication"=dword:00000000
# "SecurityLayer"=dword:00000000

# Author - Vikram Bedi 
# vikram.bedi.it@gmail.com 

#Powershell v2.0
#v1.0 Initial Script

$registryPath = "HKLM:SYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-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
  }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读