Posted On July 9, 2019

PowerShell: Enabling and Disabling Network Level Authentication (NLA)

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: Enabling and Disabling Network Level Authentication (NLA)

NLA is Microsoft’s answer to mitigate some DDoS attacks via remote desktop (RDP). It uses CredSSP, which allows RDP to delegate the user’s credentials from the client to the target server for remote authentication. By default, it’s turned on. If you want to turn it off for fun, here you go. Just kidding – don’t do it.

$server = "SHERVER007"

# View the current NLA setting: 1 is on, 0 is off
(Get-WmiObject -class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices -ComputerName $server -Filter "TerminalName='RDP-tcp'").UserAuthenticationRequired

# Setting the NLA information to Disabled
(Get-WmiObject -class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices -ComputerName $server -Filter "TerminalName='RDP-tcp'").SetUserAuthenticationRequired(0)

# Setting the NLA information to Enabled
(Get-WmiObject -class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices -ComputerName $server -Filter "TerminalName='RDP-tcp'").SetUserAuthenticationRequired(1)

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

PowerShell: Recover Deleted Active Directory Objects

$domain="kimconnect"$ltd="com"$dc="dc01"$userToRecover="Tom Cruise"# Enable Active Directory Recycle Bin# Enable-ADOptionalFeature 'Recycle Bin Feature' -Scope ForestOrConfigurationSet -Target "$domain.$ltd"…

Upgrade Virtual Hardware Version in VMM

The following script will upgrade all guest virtual machines from a lower version to the…

PowerShell: Set Application CPU Affinity on Remote and Local Computers

# setProcessNameToCpuNumber.ps1$computerName =$env:computername$processname="Chrome";function getProcessors{ param( $computerName=$env:computername ) [int]$processors = 0; $cpuObject = Get-WmiObject -computername $computerName…