What It Does
The script is read-only. It writes one row per control and ends with N of M controls pass, naming the fails. It covers operating system support status, the age of the last patch, BitLocker on the operating system drive, antivirus active, an EDR agent from a short list of products, the three firewall profiles as enforced, the local Administrators group, Remote Desktop and Network Level Authentication, SMB1, Secure Boot, TPM, the machine screen lock timeout policy, local password length, complexity and lockout, a backup product present, and remote access tools present.
Pass and Fail are stated only when the evidence supports them. Unknown means the script could not read it, or that a person has to judge it. The EDR row is Unknown when no product from its short list is found, and the remote access row is Unknown when tools are found, because the script cannot tell your approved tool from an unapproved one.
Limits to know: patch age is the newest of Get-HotFix and the KB-numbered updates in the update history. OS support uses a built-in table of end-of-support dates, and Extended Security Updates and LTSC editions are not detected. The screen lock row reads only the machine policy InactivityTimeoutSecs. The backup row shows only that a product is present, so use test-backup-status to know whether it succeeded.
Set MaxPatchAgeDays, MaxScreenLockSeconds, MinPasswordLength and MaxLocalAdmins to hold the device to the standard the questionnaire asks for.
Before You Run It
- Read the questionnaire first and set the four thresholds to match what it asks.
- Treat Unknown as a prompt for a person to look, especially the EDR and remote access rows.
- On a domain-joined PC the password rows show the effective policy, which includes domain Group Policy.
- Use ExportPath to save a CSV for the client file, and run it on a representative PC of each kind.
Type and Risk
- Type: Report. It collects facts into a table and never alerts. It exits 0, or 2 when it could not run.
- Risk: Low. It reads and changes nothing.
- Restart: It never restarts the machine.
- Typical run: Under 60 seconds.
- Example answer: "11 of 17 controls pass; fails: BitLocker, Firewall, Screen lock; 1 unknown"
- 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.
- MaxPatchAgeDays: Fail the patch row when the newest update is older than this many days. Whole number, 1 to 3650. Default 45.
- MaxScreenLockSeconds: Fail the screen lock row when InactivityTimeoutSecs is not set or is longer than this. Whole number, 1 to 86400. Default 900 (15 minutes).
- MinPasswordLength: Fail the password length row when the local minimum is shorter than this. Whole number, 1 to 128. Default 8.
- MaxLocalAdmins: Fail the local administrators row when the Administrators group has more members than this. Whole number, 1 to 100. Default 3.
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.