Skip to content
Menu

NTLMv1 and LM Hashes Still Allowed

Alerts when the LAN Manager authentication level is below what you want, LM hashes are stored, or recent sign-ins used NTLMv1 or LM. Lists who and from where. Read-only.

NTLMv1 and LM hashes still allowed is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review NTLMv1 and LM hashes still allowed. Tell other MSPs how it worked for you.

Write a Review

LanguagePowerShell
Runs onWindows 10, 11, Server 2016+ (best on each DC); runs as SYSTEM
NeedsPowerShell 5.1, administrator rights (reads the Security log), Audit Logon success for the sign-in check
Read-onlyReads, changes nothing

What It Does

The script checks three things and ALERTs when any fails. First, LmCompatibilityLevel, the policy LAN Manager authentication level. Level 3 sends NTLMv2 only but a domain controller still accepts LM and NTLM, level 4 refuses LM, and level 5 refuses LM and NTLM. It fails when the level is below MinLmCompatibilityLevel, default 5, and a missing value counts as 3, the documented default.

Second, NoLMHash, the policy that stops LAN Manager hashes being stored on the next password change. It fails when it is 0, and a missing value counts as on. Third, with CheckEvents true, it reads the Security log for successful logon events in the last LookbackHours hours that used NTLMv1 or LM, and writes one row per user, workstation, address and package with a count.

Use the sign-in list to check which users and devices this computer saw using NTLMv1 or LM before you raise the level. It needs successful logon auditing and only sees sign-ins logged on this computer. Check each domain controller. An empty result can also mean auditing is off, and the output warns if the grouped list is capped.

It never changes a setting. To raise the level, use a Group Policy on the domain controllers after the sign-ins stop appearing.

Before You Run It

  • Run it on each domain controller, as an administrator, since it reads the Security log.
  • Check that Audit Logon (success) is on, or an empty sign-in list means nothing.
  • Set MinLmCompatibilityLevel to the level you are heading for. Raise it only after the sign-in list is empty.
  • Use a longer LookbackHours for devices that sign in rarely, such as monthly jobs.

Type and Risk

  • Type: Monitor. It checks one condition. It exits 1 when it finds the problem, so your RMM can alert on it, 0 when all is well, and 2 when it could not run.
  • Risk: Low. It reads and changes nothing.
  • Restart: It never restarts the machine.
  • Typical run: Under 30 seconds.
  • Example answer: "LmCompatibilityLevel 3 (want 5 or more); 4 NTLMv1 or LM sign-in(s) in the last 24 h"
  • Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.

Inputs

Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.

  • MinLmCompatibilityLevel: The lowest acceptable LmCompatibilityLevel, 0 to 5. Default 5.
  • LookbackHours: How far back to look for NTLMv1 or LM sign-ins. Whole number 1 to 720. Default 24.
  • CheckEvents: true to read the Security log. Default true.

Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

test-ntlm-settings.ps1 · 831 lines · 42.7 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.