Command Line User Administration Tutorial for Windows User

Satish Tiwary's picture

People working on linux machine when shift to windows machine for sometimes or accidently, then they also like to work on command line even on windows machines.This article is all about how to manage user through command line in windows machine This tutorial is helpful not only for computer geeks,working employee but also for students who love to work in command mode even in Windows PC .

In this article like unix/linux we will learn how to manage users in CLI mode on windows machine.We learn how to create,delete,list,see users and manage them.


See list of users present in your windows machine.

If you are working on a windows machine and you want to know how many users are in this machine you can use "net users" command to see the list.Even few more intresting commands are available there to show you the users in brief and in detail.

C:\Users\slashroot>net users

User accounts for \\SLASHROOT-PC

Administrator            Guest                    linux
root                     slashroot
The command completed successfully.


Even you can use wmic command to see brief and full information of list of users available in your windows machine.

C:\Users\slashroot>wmic useraccount list brief

C:\Users\slashroot>wmic useraccount list full

C:\Windows\system32>wmic useraccount get name

See the list of users groups present in your local machine.

C:\Windows\system32>net localgroup


Know the username of loged in user.

If you want to know what the exactly name of the user you are loged in you can use below command .

C:\Users\slashroot>echo %username%


Know who loging now.

This command is same as it is in unix based machine and helps you to know user from which you logged in, in both wondowa and unix/linux.


Adding a new user.

If you want to add a new user to youe windows machine you can use any of two command given below.


C:\Users\slashroot>net user satish satish123 /add

C:\Users\slashroot>net user  /add slashroot slashroot123

Note:In above command satish and slashroot are the name of the users and satish123 and slashroot123 are their passwords.

See the detail information of a particular user.

If you want to know detail information about any existing users like their expiry date,full name etc  you can use this command.This command will give you complete details about an user.Here in example the command launched is used to see the detail information of user satish.

C:\Users\slashroot>net user satish

Deleting user in windows machine.

If you want to delete any of your existing user in your windows machine you can go with below command.

C:\Users\slashroot>net user  slashroot /del

Enable or Disable a Windows User.

When you purchase your Laptop or PC  with windows7/vista installed in it,Bydefault administrator user is disabled.So if you want to enable your administrator user you can use the below command with option "/active:yes ".In similar fashion if you want to disable your user you can use the same coomand with option "/active:no".

C:\Users\slashroot>net user  administrator /active:yes

C:\Users\slashroot>net user  administrator /active:no

Force windows machine to generate random password for Your windows user.

If you want to use a strong password you can use this command and force windows machine to produce a random and strong password for your user.Here we use below command to add a user named satish and then generate a random password for him.

C:\Users\slashroot>net user  satish /random /add

Change password of any user.

Below command is used when you want to change the password of any user.Here we are going to change the password of user satish.

C:\Windows\system32>net user satish *
Type a password for the user:
Retype the password to confirm:
The command completed successfully.

Stop users from changing their own password.

Bydefault users can change their password,but if you want user cannot change their own password you can use below command.

C:\Windows\system32>net user satish satish123  /passwordchg:no

But again if you change your mind and want to allow users to change their password you can simply use below command.

C:\Windows\system32>net user satish satish123  /passwordchg:yes

Set Expiry dates for users.

Bydefault account expires set to never.So if you want to set accout expiry date for user satish to Never you don't need to run any command because already account expires set to Never.

C:\Windows\system32>net user satish satish123  /expires:never

But if you want to set user account expiry date according to your requirement you can follow the below command.

C:\Windows\system32>net user satish satish123  /expires:mm/dd/yy

Now see the example:Here i am going to set account expiry date for user satish to 26th january2014.

C:\Windows\system32>net user satish satish123  /expires:01/26/2014

Disable password for a account.

We can disable or enable password for any windows user using below command.In your windows machine bydefault it is set to Yes which means there must have a password for that user.But if you want to disable user password you just use the option NO at last in below command.

C:\Windows\system32>net user satish satish123  /passwordreq:yes

C:\Windows\system32>net user satish satish123  /passwordreq:no

Set time for user logon.

If you want your users to be always logged on you can use below command.This command is even more intresting so you can take help from windows command promt using  "?". It will show you many more options so that you can use it according to your needs.

C:\Windows\system32>net user satish satish123  /times:ALL


Know Last Login Time of a User.

So how to know the last logged in time of a user in your windows machnie using command promt.

C:\Windows\system32>net user administrator | findstr /B /C:"Last logon"

Locking and Unlocking a User Account

So now learn how to lock and unlock a user account in windows machine using command promt.You can see below command to know how to lock or unlock windows users through CLI.

C:\Windows\system32>wmic useraccount where name='satish' set disabled=false

C:\Windows\system32>wmic useraccount where name='satish' set disabled=true

How to add a user to group.

net localgroup groupname username /add
eg:we want to add user satish to a group named LINUX.
C:\>net localgroup LINUX satish /add

How to see the users of a specific group.

c:\>net localgroup groupname

eg:Below command will show us about the users of LINUX group.

C:\>net localgroup LINUX


How to delete a user from group.

Below syntax is for deleting any user from any group.

net localgroup groupname username /delete


eg:Suppose if you want to delete user satish from group LINUX then use below command.

net localgroup LINUX satish /delete


How to see the setting of current user.

Below command is used to see the all important settings of of current user.

net accounts

How to change the minimum password length:

Using this command one can change the minimum password length.It means no one can assign password below set minimum password length.

 net accounts /MINPWLEN:5


How to set password expiry period

Now if you want to set expiry date for password you can use this command.In below example we are going to set password age to 120 days.

  net accounts /MAXPWAGE:120


How to set the Password such that it never expire.


Above command will set password expiry date to never.


How to prevent users from reusing any previous passwords used in past.


  net accounts /UNIQUEPW:4


Note:You have to run these commands as Administrator or got cmd promt and run as administrator if you are loggedin from any other user.

Rate this article: 
Average: 3.5 (606 votes)


Thanks for posting. Major windows admin stuff in one place. Thanks a ton..

if only this information could be accessed to many people it would be helpful. i love this stuff. thanks a lot for this post

How to make an admin account which will never expires
in my server Admin account is getting disabled frequently,
please help me

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.