- Net user command : Manage user accounts from command line
- Net user
- Syntax
- Parameters
- Remarks
- Examples
- CMD. Управление пользователями в Windows.
- Команда NET USER
- Синтаксис команды NET USER
- Command-Line Reference
- Prerequisites
- Feature description
- New and deprecated functionality
- Command shell overview
- Customize the Command Prompt window
- To configure the Command Prompt window
- Command-line reference A-Z
Net user command : Manage user accounts from command line
Using Net user command, administrators can manage user accounts from windows command prompt. Below are some examples on how to use this command.
Add a domain user account:
Add new user on local computer:
Advanced options to add new user account can be read in the below article.
Add new user from windows command line.
Disable/Lock a domain user account:
To enable/unlock a domain user account:
Prevent users from changing their account password:
To allow users to change their password:
To retrieve the settings of a user:
thaaaaaaaaanx man for the precious information
One Extra Feature that might be very useful.. is to set the Password to Never Expires:
I am using the /EXPIRES:NEVER switch on the end of the command, however the Never Expires checkbow is not ticked when i check the properties
Please notice that the /expires – switch prevents the the account from expiring, but not to the password.
That’s correct. Thanks Ray for clarifying it here for the benefit of others.
Use This Command To Set “Password Never Expire”
WMIC USERACCOUNT WHERE “Name=’username_here’” SET PasswordExpires=FALSE
Is there a way to change the net user username?
My question is how to create multiple users on a network through a command in command prompt using only single command line.
with a loop for.
FOR/L %variable IN (start, step, end) DO command [Settings]
for /L %U in (10,1,20) do net user user-%U Password /add /dom
(to create 10 users named user-10, user-11 to user-20)
check FOR /F [“options”] %%parameter IN (“Text string to process”) DO command
it’s works but not secure
Very good post on windows command line. Thanks for sharing.
Your command for “Add a domain user account” is incorrect, the proper one is:
Net user domainuser domainpassword /add /domain
Gives result:
“The request will be processed at a domain controller for domain softros.local.
The command completed successfully.”
hi how can i create multiple users from cmd
but just with one command??
i know for creating a new user i can use this:
net user username password /add
and to make him an administrator i can use this:
net user username password administrator /add
correct me if i’m wrong and help me please.
Your query, [hi how can i create multiple users from cmd
but just with one command??] – did you ever get an answer to that question ?
Please let me know.
i am currently locked out of my local administrator account on my windows server 2008 r2
i am able to change user accounts and passwords how ever it still telling me that my username or password is incorrect.
i have created a new user account and password but even the new user account and password doesnt work.
Is there a way to put a number of hours logon to the guest account?
interesting stuff here .. Thanks …
hi every body…
please help me how to add users with environment variable(starting program)?
How can I know who changed password for a user on windows server 2008 R2 from CMD and OS?
How can I check from our Internal domain and not our normal /domain?
Thanks so much! However is there a line to reset a password?
Hi I have forgotten my password to get onto the two accounts set up. When I go into net user neither accounts are showing. I get a message saying
The command completed with one or more errors
Can anyone help
hello guys in my college when i type the command “net users” it shows two accounts one is “guest” and another is “administrator” but in the login screen there are two accounts one is “guest” and another is “ADMIN” .why this ‘ADMIN’ account is not showing in the cmd.
Is there a command line command to add a group or user name under the security tab option Group or user names: for a domain user?
How to check a user which was created in a different trusted domain. Not to the machine joined.
How can we check for an account creation or disablement date in cmd
How can we run a command to replace the email address in AD from powershell
I need your assistance with batch command tomake this change in my secpol.msc!
i need to set the “password policy” > Password must meet complexity….. to be DISABLED or ENABLED
Just be aware that unlocking/enabling a user account also sets it so that the password must be changed on next logon.
I limit login time with “net user time” command of our son account on W10, but when time expire … he is logout from his User account and login under Admin account WITHOUT been asked for Admin´s password!
Any idea why? Thank you.
Please help me can you find the password for profile, when you are on it.
The article seems to think these are the same things.
They are NOT:
Enabled/disable an account.
Lock/unlock an account.
why does the last logon line read “never”? i have this with my current user which i am trying to time restrict. it wont restrict because it claims to have never logged in.
How can I pull the information of a user who is the different domain in Active Directory like IN or BR or AR?
Hello,
Great read! I am hoping u can help me. I am trying to set time limits for a user. However it completed successfully and still allows user to logon when he is not supposed too! Any advice.
what command i can use get net user status in a single query ?i looking for the format
example
account status
admin enabled
Net user
Applies To: Windows Server 2003, Windows Vista, Windows Server 2008, Windows Server 2003 R2, Windows Server 2000, Windows Server 2012, Windows Server 2003 with SP1, Windows 8
Adds or modifies user accounts, or displays user account information.
Net user is a command-line tool that is built into Windows Vista. To run net user, open a command prompt, type net user with the appropriate parameters, and then press ENTER.
For examples of how this command can be used, see Examples.
Syntax
Parameters
Specifies the name of the user account to add, delete, modify, or view. The name of the user account can have as many as 20 characters.
Assigns or changes a password for the user’s account. Type an asterisk (*) to produce a prompt for the password. The password is not displayed when the user types it at the password prompt.
Performs the operation on the domain controller in the computer’s primary domain.
Specifies a command-line option. Refer to the next table for descriptions of the command-line option syntax.
Displays help for the specified net command.
Command-line option syntax
Enables or disables the user account. If the user account is not active, the user cannot access resources on the computer. The default is yes (that is, active).
Provides a descriptive comment about the user’s account. This comment can have as many as 48 characters. Enclose the text in quotation marks.
Uses the operating system Country/Region codes to implement the specified language files for a user’s Help and error messages. A value of 0 signifies the default Country/Region code.
Causes the user account to expire if you specify the date. Expiration dates can be in [MM/DD/YYYY], [DD/MM/YYYY], or [mmm,dd,YYYY] formats, depending on the Country/Region code. Note that the account expires at the beginning of the specified date. For the month value, you can use numbers, spell it out, or use a three-letter abbreviation (that is, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec). You can use two or four numbers for the year value. Use commas or slashes to separate parts of the date. Do not use spaces. If you omit , the next occurrence of the date (that is, according to your computer’s date and time) is assumed. For example, the following entries are equivalent if entered between Jan. 10, 1994, and Jan. 8, 1995:
jan,9
1/9/95
january,9,1995
1/9
Specifies a user’s full name rather than a user name. Enclose the name in quotation marks.
Sets the path for the user’s home directory. The path must exist.
Specifies whether users can change their own password. The default is yes.
Specifies whether a user account must have a password. The default is yes.
Sets a path for the user’s logon profile. This path points to a registry profile.
Sets a path for the user’s logon script.
cannot be an absolute path.
is relative to %systemroot%\System32\Repl\Import\Scripts.
Specifies the times that users are allowed to use the computer. is limited to one-hour increments. For the values, you can spell out the names of the days or use abbreviations (that is, M,T,W,Th,F,Sa,Su). You can use 12-hour or 24-hour notation for hours. If you use 12-hour notation, use AM and PM, or A.M. and P.M. The value all means a user can always log on. A null value (blank) means a user can never log on. Separate day and time with commas, and separate units of day and time with semicolons (for example, M,4AM-5PM;T,1PM-3PM). Do not use spaces when you designate times.
Specifies that an administrator can add or change the «User comment» for the account. Enclose the text in quotation marks.
Lists as many as eight workstations from which a user can log on to the network. Separate multiple entries in the list with commas. If /workstations has no list or if the list is an asterisk (*), users can log on from any computer.
Remarks
When you use net user without parameters, it displays a list of the user accounts on the computer. You can also type net users.
A password must satisfy the minimum password length value that is set with the net accounts /minpwlen command. A password can have as many as 127 characters.
Examples
The following example displays a list of all user accounts for the local computer:
The following example displays information about the user account tommyh:
CMD. Управление пользователями в Windows.
Управление пользователями в Windows, помимо графической оснастки «Учетные данные пользователей», расположенной в панели управления, можно производить с помощью командной строки.
Команда NET USER
Команда NET USER предназначена для просмотра, добавления или редактирования учетных записей пользователей на компьютерах. При выполнении команды в командной строке без параметров отображается список учетных записей пользователей Windows, присутствующих на компьютере(локальные УЗ). Информация об учетных записях пользователей хранится в базе данных Windows.
Синтаксис команды NET USER
net user [имя_пользователя [пароль | *] [параметры]] [/domain]
net user имя_пользователя <пароль | *>/add [параметры] [/domain]
net user имя_пользователя [/delete] [/domain], где
- имя_пользователя — Указывает имя учётной записи пользователя, которую можно добавить, удалить, отредактировать или просмотреть. Имя может иметь длину до 20 символов.
- пароль — Присваивает или изменяет пароль пользователя. Введите звездочку (*) для вывода приглашения на ввод пароля. При вводе с клавиатуры символы пароля не выводятся на экран.
- /domain — Выполняет операцию на контроллере основного для данного компьютера домена.
- параметры — Задает параметр командной строки для команды.
- net help команда — Отображение справки для указанной команды net.
- /delete — Удаление учетной записи пользователя.
Command-Line Reference
Applies To: Windows Server 2003, Windows Vista, Windows XP, Windows Server 2008, Windows 7, Windows Server 2003 R2, Windows Server 2008 R2, Windows Server 2000, Windows Server 2012, Windows 8
Use this topic to find the documentation resources and other technical information that you need to learn about the command shell, and to automate command-line tasks by using scripts or scripting tools.
To read introductory information about the command shell and command-line tools, see Feature description. To see a listing of new and deprecated command-line tools see New and deprecated functionality.
To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.
Prerequisites
The information that is contained in this overview applies to:
Windows Server 2012
WindowsВ ServerВ 2008В R2
WindowsВ ServerВ 2008
WindowsВ ServerВ 2003В R2
WindowsВ ServerВ 2003
Feature description
New and deprecated functionality
New or Deprecated?
Create a new cluster or configure an existing cluster.
Configure DFS folders and folder targets in a DFS namespace.
Creates and manages File Server Resource Manager quotas.
Create and manage file groups, file screens, file screen exceptions, and file screen templates that are used to configure general administrative options for screening files.
Enable optional features in Windows by downloading required files from WindowsВ Update or a source that Group Policy specifies.
Read, write, run, debug, and test Windows PowerShell scripts and modules in a friendly, graphic-assisted environment.
Install or remove roles, role services, and features.
Monitor an RD Session Host session.
Create and manage storage reports and storage report tasks, and configure general administrative options for File Server Resource Manager.
Command shell overview
The command shell is a software program that provides direct communication between the user and the operating system. The non-graphical, command shell user interface provides the environment in which you run character-based applications and utilities. The command shell executes programs and displays their output on the screen by using individual characters similar to the MS-DOS command interpreter, Command.com. The command shell in the Windows Server operating system uses the command interpreter, Cmd.exe. Cmd.exe loads applications, directs the flow of information between applications, and translates user input into a form that the operating system understands.
You can use the command shell to create and edit scripts to automate routine tasks. For example, you can create simple scripts in batch (.bat) files to automate the management of user accounts or nightly backups. You can also use the command-line version of Windows Script Host to run more sophisticated scripts in the command shell. For more information, see Cscript or Wscript. You can perform operations more efficiently by using scripts than you can by using the user interface. Scripts accept all commands that are available at the command line.
Customize the Command Prompt window
You can change the properties for the Command Prompt window.
To configure the Command Prompt window
Open a Command Prompt window, click the upper-left corner of the Command Prompt window, and then click Properties. (Or to open Command Prompt Properties from the keyboard, press ALT+SPACEBAR+P.)
Click the Options tab.
In Command History, type or select 999 in Buffer Size, and then type or select 5 in Number of Buffers. By increasing the screen buffer size to 999, you enable scrolling through the Command Prompt window. By increasing the number of buffers to five, you increase the number of lines in the Command Prompt window to 5000.
In Edit Options, select the Quick Edit Mode and Insert Mode check boxes.
Click the Layout tab.
In Screen Buffer Size, type or select 2500 in Height.
To further customize your Command Prompt window settings, perform any of the following optional tasks:
In Screen Buffer Size, increase Width.
In Window Size, increase Height.
In Window Size, increase Width.
Clear the Let system position window check box, and then, in Window Position, change the values in Left and Top.
In the Apply Properties dialog box, click Save properties for future windows with same title.
To enable or disable file and directory name completion on a computer or user logon session, run Regedit.exe and set the following REG_DWORD value : HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD To set the REG_DWORD value, use the hexadecimal value of a control character for a particular function (for example, 0Г—9 is Tab and 0Г—08 is Backspace). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.
Command-line reference A-Z
To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.
Each command-line tool topic displays the version of Windows that is supported by the command-line tool.