How to List Local Users with PowerShell

Have you ever needed to view all the local users on your Windows machine quickly? You can achieve this using Microsoft PowerShell.

In this tutorial, I will explain several proven PowerShell methods to list local users from your Windows machine.

Method 1: Using the Get-LocalUser Cmdlet

The most straightforward way to list local users is with the Get-LocalUser cmdlet, which is part of the Microsoft.PowerShell.LocalAccounts module. This command retrieves all local user accounts, including built-in accounts and those connected to Microsoft accounts.

To list all local users on your system, simply run:

Get-LocalUser

This command will display a table with basic information about each user account, including the name, SID, and account status. This command returns all local user accounts, including built-in ones like Administrator and Guest.

Here is the exact output in the screenshot below:

List Local Users with PowerShell

You can filter for enabled or disabled accounts using Where-Object:

# List only enabled accounts
Get-LocalUser | Where-Object {$_.Enabled -eq $true}

# List only disabled accounts
Get-LocalUser | Where-Object {$_.Enabled -eq $false}

If you need more comprehensive information about your local users, you can pipe the results to Select-Object or simply Select:

Get-LocalUser | Select *

This displays all available properties for each user account, including:

  • Account expiration dates
  • Password last set time
  • Account status (enabled/disabled)
  • Description
  • Full name

To find a specific user by name, use the -Name parameter:

Get-LocalUser -Name "JSmith"

You can also use wildcards to find users matching a pattern:

Get-LocalUser -Name "J*"

This would return all users whose names start with “J” – very useful when searching for employees in larger departments.

Check out Check Who Modified a File Last in Windows Using PowerShell

Export Local Users to CSV for Reporting

Often, you’ll want to save the user list for documentation or reporting. PowerShell makes it easy to export results to a CSV file for sharing with your IT team or archiving for audits.

Get-LocalUser | Export-Csv -Path "C:\Reports\LocalUsers.csv" -NoTypeInformation

This command exports all local users to a CSV file, which you can open in Excel.

For a more readable text report; you can use the below PowerShell cmdlet:

Get-LocalUser | Format-Table Name, Enabled, Description, LastLogon -AutoSize | Out-File -FilePath "C:\Reports\UserReport.txt"

Read Delete User Profiles Using PowerShell in Windows 11

Method 2: Querying Local Users with net user (Works on All Windows Versions)

If you’re working on older systems or want a method that works everywhere, net user is a classic command-line tool accessible via PowerShell.

net user

This lists all local user accounts in a simple text format. It’s especially useful when you’re remoting into legacy servers or need a quick answer without worrying about PowerShell module versions.

To get detailed info about a specific user (say, Jessica.Taylor)

net user Jessica.Taylor

This provides details like account status, password policies, and group memberships—great for troubleshooting or audits.

Check out Track User Login History on Windows Using PowerShell

Method 3: Using WMI and CIM for Advanced Queries

For advanced scenarios—like pulling user data from remote computers in your organization—WMI (Windows Management Instrumentation) and CIM (Common Information Model) cmdlets are invaluable.

WMI Example:

Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount=True"

CIM Example (Preferred for Remoting):

Get-CimInstance -ClassName Win32_UserAccount -Filter "LocalAccount=True"

These commands return rich objects with properties like Name, Disabled, and Domain. I use these methods when I need to script user audits across multiple machines or generate detailed reports for compliance.

Check out Set the Default Printer Using PowerShell in Windows

Get Local Users from Remote Computers

You can also get all the local users from remote computers:

Here’s how to list users on remote computers using PowerShell:

Invoke-Command -ComputerName "Server01" -ScriptBlock {Get-LocalUser}

For multiple servers, you can use an array:

$servers = @("Server01", "Server02", "Server03")
Invoke-Command -ComputerName $servers -ScriptBlock {Get-LocalUser}

Comparing Methods: Which Should You Use?

MethodBest ForWorks On
Get-LocalUserModern Windows, scripting, exportsWin 10/11, Server 2016+
net userLegacy systems, quick checksAll Windows
Get-WmiObject/Get-CimInstanceRemote queries, advanced filteringAll Windows

In this tutorial, I explained how to list local users using PowerShell from a Windows machine.

You may also like the following tutorials:

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.