PowerShell Genie

Get-LocalUser

Use Get-LocalUser to list local user accounts on a Windows machine with their enabled state and password settings.

Command 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn — PowerShell module reference

Syntax

1PS> Get-LocalUser [[-Name] <string[]>] [-SID <SecurityIdentifier[]>] [<CommonParameters>]
See the command anatomy

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Get-LocalUser [[-Name] <string[]>] [-SID <SecurityIdentifier[]>] [<CommonParameters>]
  1. Stage 1Get-LocalUser-Name -SID

    Try it

    Windows PowerShell

    PowerShell example · browser support is limited.

    Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.

    Interactive simulation · fictional data

    Examples

    Select Name, Enabled, PasswordLastSet, LastLogon

    1PS> Get-LocalUser | Select-Object Name, Enabled, PasswordLastSet, LastLogon
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Name           Enabled  PasswordLastSet  LastLogon
    -------------  -------  ---------------  --------------------
    Administrator  True                      9/10/2026 7:52:09 PM
    svc_backup     True                      9/10/2026 2:00:15 AM

    Filter by Enabled and PasswordExpires

    1PS> Get-LocalUser | Where-Object { $_.Enabled -and -not $_.PasswordExpires }
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Name           Enabled  LastLogon
    -------------  -------  --------------------
    Administrator  True     9/10/2026 7:52:09 PM
    svc_backup     True     9/10/2026 2:00:15 AM

    Get-LocalUser -Name Administrator

    1PS> Get-LocalUser -Name Administrator | Select-Object Name, Enabled
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Name           Enabled
    -------------  -------
    Administrator  True
    svc_backup     True

    Parameters

    Parameter definitions:

    • -Name
    • -SID

    PowerShell module reference on Microsoft Learn

    Practical use and troubleshooting

    Practical scenario: Use Get-LocalUser when you need to list local user accounts on a Windows machine with their enabled state and password settings. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.

    Common error and fix: Command not recognised can occur in an unsupported host architecture. The LocalAccounts module is not available in 32-bit PowerShell on a 64-bit system; use the supported 64-bit host. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.

    See also: Get-LocalGroup. Get-LocalUser reads local accounts; Get-LocalGroup reads local groups. Local membership and Active Directory membership are separate inventories even when names look similar. Read the linked command before substituting it; similar names do not imply identical inputs or output.

    Get-LocalUser reference on Microsoft Learn

    Recap

    Get-LocalUser Use Get-LocalUser to list local user accounts on a Windows machine with their enabled state and password settings.

    Next: Get-NetFirewallRule
    Genie guideGet-LocalUser

    Use Get-LocalUser to list local user accounts on a Windows machine with their enabled state and password settings. The console below is pre-loaded — run it, then change a value and run it again.