← script library

Check User Account Security Settings

Security & AuditingJanuary 11, 2025

This PowerShell script helps you audit the security settings of user accounts on your system. It provides details such as password policies and account status, ensuring that your user accounts are securely configured.

powershell
$users = Get-LocalUser

$users | Select-Object Name, Enabled, PasswordNeverExpires, UserMayChangePassword | Format-Table -AutoSize

$passwordPolicy = Get-LocalPolicy | Select-Object MinPasswordLength, PasswordComplexity
Write-Output "Password Policy Settings:"
$passwordPolicy

$insecureAccounts = $users | Where-Object { -not $_.Enabled -or $_.PasswordNeverExpires }
$insecureAccounts | Select-Object Name, Enabled, PasswordNeverExpires | Format-Table -AutoSize

Run it across your fleet

This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.

Ready when you are.

Try ServerEngine free for 7 days.