The Net Command Line to List Local Users and Groups

Normally, we can find the list of local users or groups created on a windows system from User Accounts applet in Control Panel,

User Accounts in Control Panel

User Accounts in Control Panel

Or, more in detail in Computer Management MMC, which is my favorite place when checking things like this.

Users and Groups in Computer Management MMC

Users and Groups in Computer Management MMC

But do you know you can actually get them more effectively through a built-in command line Net?

To get the list of local users on the computer, run

net users

C:\Windows\system32>net users
User accounts for \\C-20130201
------------------------------------------------------
Administrator            Guest                    Kent
The command completed successfully.

To get the very detail information about a particular user, including the password policies, login script used, and the local groups s/he belongs to, run

net users username

C:\Windows\system32>net users Kent
User name                    Kent
Full Name                    Kent Chen
Comment
User's comment
Country/region code          000 (System Default)
Account active               Yes
Account expires              Never
Password last set            01/02/2013 1:10:37 PM
Password expires             Never
Password changeable          01/02/2013 1:10:37 PM
Password required            Yes
User may change password     Yes
Workstations allowed         All
Logon script
User profile
Home directory
Last logon                   01/02/2013 1:10:37 PM
Logon hours allowed          All
Local Group Memberships      *Administrators       *HomeUsers
Global Group memberships     *None
The command completed successfully.

To get the list of local groups available, run

net localgroup

C:\Windows\system32>net localgroup
Aliases for \\C-20130201
-----------------------------------------------
*__vmware__
*Access Control Assistance Operators
*Administrators
*Backup Operators
*Cryptographic Operators
*Distributed COM Users
*Event Log Readers
*Guests
*HelpLibraryUpdaters
*HomeUsers
*Hyper-V Administrators
*IIS_IUSRS
*Network Configuration Operators
*Performance Log Users
*Performance Monitor Users
*Power Users
*Remote Desktop Users
*Remote Management Users
*Replicator
*SQLServer2005SQLBrowserUser$C-20130201
*SQLServerMSASUser$C-20130201$MSSQLSERVER
*Users
*WinRMRemoteWMIUsers__
*WSS_ADMIN_WPG
*WSS_WPG
The command completed successfully.

To get the list of members who belong to a specific group, run

net localgroup groupname

C:\Windows\system32>net localgroup administrators
Alias name     administrators
Comment        Administrators have complete and unrestricted access to the computer/domain
Members
---------------------------------------------------------
Administrator
Kent
MHNETWORK\Domain Admins
The command completed successfully.

What’s more powerful is that if you run the same net commands on a domain controller that hosts a lot more user accounts, groups than a local workstation holds, such as a command like below returns the full domain groups you have created in the same DC.

Net Group

Give it a try, if you have access to a domain controller.

Kent Chen

Microsoft MVP, IT Professional, Developer, Geek, and the co-founder of Next of Windows.

Last updated: 01/12/2016

Posted in: Tips & Tricks
Discover more: , ,