List of user groups command line

by admin on September 4, 2010

On Windows OS we can find the list of local user groups created on a system from Contorl Panel -> User Accounts. This information can be obtained from command line also using net command.  Syntax is shown below.

net localgroup

Example: Running this command shows the following local groups on my system.

C:\>net localgroup
Aliases for \\techblogger-pc
*Backup Operators
*Debugger Users
*Network Configuration Operators
*Power Users
*Remote Desktop Users
The command completed successfully.

How to list the users in a local group?

Use the below command to know the list of members of a group from command line.

net localgroup groupName

For example to get the list of all remote desktop users on a system we can run the below command.

net localgroup "Remote Desktop users"

How to find the list of all groups a user is member of?
You can run the below command to list the groups a user is member of.  This command prints the details of the given user account. You can find the group membership information in the last two line of this command output.

net user userName


H:\>net user John
User name                   John
Full Name
User's comment
Country code                 000 (System Default)
Account active               Yes
Account expires              Never
Password last set            12/2/2010 11:00 PM 
Password expires             4/1/2011 11:00 PM 
Password changeable          12/2/2010 11:00 PM 
Password required            Yes 
User may change password     Yes 
Workstations allowed         All 
Logon script 
User profile 
Home directory 
Last logon 
Logon hours allowed          All 
Local Group Memberships      *Debugger Users       *Users 
Global Group memberships     *None

Related Posts:
Add user to group from windows command line
Remove user from group using windows command prompt

{ 5 comments… read them below or add one }

Kennedy February 8, 2012 at 8:51 pm

Useful references, however “net use username” should be changed to “net user username”


admin February 9, 2012 at 5:12 am

Thank you Kennedy. Corrected the command.

SD March 10, 2012 at 6:10 am

Please get me a command which will display all local users as: LOGIN, FULL NAME, DESCRIPTION, GROUP etc..


Doug March 11, 2012 at 6:23 am

I’d just like to express my frustration with this API. As you can see in these examples, thet net API localgroups functionality will happily list all members of a group. However the net user code completely ignores system accounts, as does most of the rest of what Windows makes available. Internally they are organized as a subclass of Win32_Account but not Win32_UserAccount. So it’s possible to retrieve a bunch of useless information from the Windows API. This happens with LookupAccountSid as well. If you give it an SID like S-1-5-20, it will give you an answer. But the answer it gives you can’t be used as input for anything else, which is obnoxious.


Werezwolf July 24, 2014 at 6:24 am

You can query if users exist by doing

SET /P query_user=What user do i look for?
::Take out /domain if you want to look on the local computer
Net User %query_user% /domain
if NOT %errorlevel% == 0 goto s_error_1
if %errorlevel% == 0 goto s_success_1

Leave a Comment

HTML tags are not allowed.

Previous post:

Next post: