What It Does
The script is read-only. It checks three places SMB1 can be on: the SMB server setting, from Get-SmbServerConfiguration EnableSMB1Protocol, with a fallback to the registry or enabled optional features if the cmdlet fails; the Windows optional features SMB1Protocol, SMB1Protocol-Client and SMB1Protocol-Server, where Enabled or EnablePending is on; and the SMB1 client driver mrxsmb10, when its driver file is present and its service is not disabled. Any of them on is an alert.
With AuditDays above 0 it also reads the SMB server audit log (Microsoft-Windows-SMBServer/Audit, event 3000, SMB1 access) for that many days and lists up to 25 client addresses seen using SMB1 in the table, with event counts and the latest event time. Turning that auditing on is not this script's job. When it is off the script says so, and an empty list then means unknown, not nobody. Enable it with Set-SmbServerConfiguration -AuditSmb1Access $true, wait a few weeks, then read this list before running disable-smb1.
After disable-smb1 the SMB1 client driver file stays until the next restart, so the client line can still alert until then.
Before You Run It
- Turn on SMB1 auditing and wait a few weeks, so the client list means something.
- Read the client list, and sort out the devices that still use SMB1, before you run disable-smb1.
- Expect the client driver line to alert until the restart after disable-smb1.
- Schedule it in your RMM and alert on exit 1.
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: "SMB1 server is enabled; SMB1 optional feature SMB1Protocol is enabled; 2 clients used SMB1 in the last 7 days (10.0.0.5, 10.0.0.9)"
- 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.
- AuditDays: How many days of the SMB1 access audit log to read. Whole number 0 to 365; 0 skips the audit. Default 7.
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.