Get-LocalUser
List local user accounts
Get-LocalUser | Select-Object Name, Enabled, LastLogon
- Works on
- Windows
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Get-LocalUser
- PowerShell 7 Works natively on Windows 10 version 1809 and later. Not available in 32-bit PowerShell on 64-bit Windows; use the normal 64-bit PowerShell window.
Lists accounts stored on this computer only. Domain and Microsoft-account sign-ins appear here only if they also have a local account.
Reading the list does not need an administrator prompt. Creating or changing accounts does.
Try this
Who is in the local Administrators group?
Get-LocalGroupMember -Group Administrators
Enabled accounts that have not signed in for 90 days:
Get-LocalUser |
Where-Object { $_.Enabled -and $_.LastLogon -lt (Get-Date).AddDays(-90) } |
Select-Object Name, LastLogon
Coming from another shell
| Shell | What you might type |
|---|---|
| cmd.exe | net user |
More in From bash and From cmd.