CoreNetworkZ Tech Solutions trains our employees (system admins) on the importance of DOS commands. A good Windows System Admin knows the wonders DOS commands can do. Today, I will teach you one DOS Command: Net User.
We can create and delete user accounts on a Windows PC in multiple methods. The easiest method, I found, is to do it from the Command Prompt. Today, we discuss the creation of a user account with a DOS command.
The second part explains the application of this DOS command in deleting and modifying a Windows user account.
Which DOS Command Can Create a Windows User Account?
You can create a user account directly from Command Prompt by a DOS command Net User.
You need administrative privileges to execute Net User Command.
This command creates a new user account on a Windows computer. This tutorial explains the use of the command net user. Then, we cover the creation of a new user account on a Windows computer from the Command Prompt.
We also check how to modify an existing user account on a Windows computer using the net user command. Let us check the procedure to create a new Windows 11 user account from the Command Prompt.
How to Create a New Windows 11 User From The Command Prompt?
Type Command Prompt on the Windows 11 Search. Click on Run as Administrator.
Type the command in the format below.
net user (user account name) (password) /add
Example: net user corenetworkz mypassword /add
Press the Enter key.
See the screenshot. You will get the reply "The command completed successfully" if Windows has created a new account.
Windows has created a new account, and I do not want to keep it. So, I am going to remove that account from my computer. Let us see how to do it from the Command Prompt.
How to Delete a Windows 11 User Account From The Command Prompt?
We can remove an unwanted Windows user account from the command prompt. Follow the steps below.
Open the Command Prompt as the "Run as Administrator" option. Type the net user command in the following format.
net user username /delete
Example: I will remove the newly created Windows user account corenetworkz from the Command Prompt. The net user command format to delete the Windows user account corenetworkz is - net user corenetworkz /delete.
You can see from the screenshot that I have successfully removed the Windows user account.
The Practical Uses and Syntax of Net User Command
I read a few comments from Stephen, Ashley, and Lukachen asking about various uses of the Net User command.
The net user command can create, delete, and edit user accounts on Windows computers. The different syntaxes to create, modify, and delete user accounts from Command Prompt are:
- To create User Account: net user Username Password /domain
- To modify User Account: net user Username Password /add /domain
- To Delete User Account: net user Username /delete /domain
While entering a username from Command Prompt for a new user account, ensure it is a maximum of 20 characters long. While typing the password for the new account, you can use a maximum of 127 characters.
How to Fetch Admin Account Details From Command Prompt?
One reader, Purnima Gupta ( left a comment ) asking if she could fetch details of other user accounts on a Windows 11 PC. Yes, you can, Purnima. It is one of the practical uses of the Net User command.
Another practical use of the net user command is to fetch the complete information about the administrator account on your Windows computer from the command prompt. See how I used the net user command to get the necessary details about the administrator account from Command Prompt.
You can see important information like the creation date of the user account, the user's country code, the last date on which the user created the password, the date on which the current password expires, etc. You can also see the last date a user accessed the account. We can also see if there is any login restriction.
The Net User Command Returns Access Denied
Oliver West asked me in the comment section why he failed to execute this command. Let me explain why he and a few others faced such a situation.
Some users reported an error while creating a new Windows user account with the net user command. The error code is 'System error 5 has occurred' with 'access is denied.
I created this error code to study it properly. The reason for getting an access denied error while creating a new user account is the privileges issues with the DOS Prompt.
You must run the DOS Prompt as an administrator to execute the net user command.
Reference
I have covered the practical uses of the DOS command Net User. For further studies, I recommend you visit the following pages.
- How to Enable the Hidden Windows 11 Administrative Account?
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc771865(v=ws.11)
- https://stackoverflow.com/questions/46311117/possible-to-use-net-user-and-get-information-about-username-on-another-domain
Hello Alex,
ReplyDeleteI executed the command, but it failed. It shows a permission error. Why?
Hi Oliver,
DeleteYou might have seen the access denied message( after executing the Net User command). It shows you opened the command prompt without admin privileges. I explained this question in the article.
Nice trick, Alex. A good tutorial. Is it possible to modify a Windows user account using Command Prompt?
ReplyDeleteYes, it is possible.
DeleteI have created a new Windows account using your method. Can I delete it using the DOS?
ReplyDeleteYes Ashley, you can do.
DeleteThat is a good tip, Alex George. I have one doubt. Can I create a new Windows account with administrative privileges from DOS?
ReplyDeleteYes Lukachen.
DeleteHello Alex,
ReplyDeleteCan I use this command to fetch necessary information about other user accounts? I know it is a bit unethical, but is it possible?
@ Purnima
DeleteYes, you can fetch information about other user accounts.