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

Basic JavaScript: Understanding Case Sensitivity in Variables

// Declarationsvar StUdLyCapVaR;var properCamelCase;var TitleCaseOver;// AssignmentsSTUDLYCAPVAR = 10;PRoperCAmelCAse = "A String";tITLEcASEoVER = 9000;

PowerShell: Error when Pause is Placed Inside Function

Error: + Function Search-ScheduledTasks{+ ~Missing closing '}' in statement block or type definition.At C:\Users\kdoan\Desktop\Notes\test.ps1:57 char:1+…

The Process of Adding a New Hyper-V Server Into a Cluster and the Associated Virtual Machine Manager (VMM)

These are the steps: Install WindowsWindows 2019 Data Center Edition is the standard as of…