List and audit local users with Get-LocalUser
The PowerShell way to enumerate local accounts and their state — objects you can filter, sort, and export for a security review.
01Command
$ Get-LocalUser | Select-Object Name, Enabled, LastLogon, PasswordLastSet02What it does
Get-LocalUser returns rich objects: Enabled, PasswordExpires, PasswordLastSet, LastLogon, and Description. That makes audit one-liners trivial — list enabled accounts, find accounts whose password hasn't changed in a year, or count dormant logins. Companions Set-LocalUser, Disable-LocalUser, and New-LocalUser handle changes without the legacy net user syntax, and results pipe straight into Export-Csv for reports.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Get-LocalUser | Microsoft LearnEvidence: Microsoft documents Get-LocalUser returning LocalUser objects with Enabled, LastLogon, and PasswordLastSet properties.
- Get-LocalUser - PowerShellEvidence: SS64 shows Get-LocalUser usage and filtering, e.g. listing only enabled accounts with Where-Object.
Last verified: 2026-09-17 · Category: Security & Privacy
06Related solutions
Read the Authenticode signature status and signer of any executable or script in PowerShell.
Understand PowerShell's execution policy scopes and set the one that lets you run your own local scripts without gutting the security model.
Search inside text files and logs with regex, returning file, line number and match.