Net user username. Adding accounts. Viewing account properties

💖 Do you like it? Share the link with your friends

Visitors to this site are often interested in how to create a new user in Windows 7. Most often, this need arises when more than one person works on the same computer. Files and shortcuts for programs from different users begin to get confused on the desktop, and this inevitably creates a lot of inconvenience. In this article, we will talk about how to create a new user in Windows 7 and solve this problem forever.

In order to create a new user, you need to open the Start menu and go to Control Panel. If you want to create a new user in Windows 8, then use our article about.

So, after you have opened the Control Panel, go to the “Add and remove accounts” section.

After this, you will see a list of accounts that have already been added to your operating system. If you haven't added anything before, there should only be two users here: the main user (which you created with ) and the guest user. To add a new user in Windows 7, click on the “Create an account” link.

That’s it, after clicking on the “Create an account” button New user will be created. Please note that if you select the “Standard User” account type, the user using such an account will not be able to install new programs or make changes to settings operating system.

How to create a new user entry in Windows 7 via command line

You can also create a new user via command line. In order to create a new Windows 7 user via the command line, you must first run it with administrator rights. We have already talked about this in one of the articles.

After that, in the command line that opens, enter the command:

For example, in order to add a user with the nickname Mike and password 123123, you must enter net user Mike 123123 /add.

After entering this command, a new user will be created. But, by default he will be a regular user (not an administrator). In order to make this user an administrator, you need to enter one more command:

  • net localgroup Administrators username /add

For example, in order to make the user Mike an administrator, we need to enter the command net localgroup Administrators Mike /add.

Everything, as we can see, adding a new user to Windows 7 using the command line is not much more difficult than adding a user through the Control Panel.

If you read the site's articles in order (not forgetting about the Directory), then you probably noticed that so far we have only briefly mentioned the Administrator account in the article Answer File Settings. And after the articles about installing applications, you probably have a question: how to organize automatic login so that the software is installed automatically after the OS and can this be done not under the Administrator account? This article is designed to answer this question: you will learn how to set up automatic login, as well as create new and rename built-in accounts. Let's start by creating accounts.

Adding accounts

There are two ways to add accounts, and we'll cover both.

Method OOBEINFO.INI

Note: the method only works for Windows XP/2003

Using this method, you simply automate the process of creating users, which is usually done manually in one of the graphical stages Windows installations- mini-setup.

Let's get started. Open Notepad and copy there following lines:


Identity000="Vadikan"
Identity001="Alex"

The username is enclosed in quotation marks; substitute yours. If you only need one user, then remove the second one. If you need more users, then add lines, increasing the number by one. This method allows you to create no more than six accounts(up to Identity005). Please note that all users will be included in the Administrators group.

When finished, save the file as oobeinfo.ini in the directory $OEM$\$$\System32\oobe. As you can see, everything is very simple.

NET USER method

This method was described in previous version site. It is more universal, because... works on all NT platforms and allows you to create as many accounts as you like, placing them in different groups.

We will create accounts during the graphical phase of Windows installation. To do this we will use the file cmdlines.txt(more about cmdlines.txt in the corresponding article). From it we will execute a batch file useraccounts.cmd, containing the commands necessary to create accounts.

If you have not yet created a file cmdlines.txt, then open Notepad and copy the following text there


"useaccounts.cmd"

Save the file as cmdlines.txt in the directory C:\XPCD\$OEM$\.

Now we need to create useraccounts.cmd. Copy the following text into Notepad:

net user Vadikan asdf1234 /add
net localgroup Administrators Vadikan /add

net accounts /maxpwage:unlimited
EXIT

Let's look at the commands in order.

  • net user Vadikan asdf1234 /add- creates user Vadikan with password asdf1234
  • net localgroup Administrators Vadikan /add- adds user Vadikan to the Administrators group
  • net localgroup Users Vadikan /delete- removes the user Vadikan from the Users group (the user is automatically added to it when created
  • net accounts /maxpwage:unlimited- allows you to avoid password expiration (14 days)

For an account placed in the Administrators group, password required. Replace the username and password as you wish and save the file as useraccounts.cmd in the directory C:\XPCD\$OEM$\. Similarly, you can add other users to the desired groups using the same file useraccounts.cmd and the net user and net localgroup commands

Attention: in the localized Russian version, the Administrators group is called Administrators, and Users is called Users. Therefore, you need to make the appropriate changes and save the file in OEM encoding (DOS 866). Notepad does not support this encoding, and another editor is needed (a list of them is in the FAQ.

Another thing to note: if you want to create a user whose name has spaces (for example, Super Vadikan), then you must enclose such a name in quotes:

net user "Super Vadikan" asdf1234 /add

Combined method

After studying both methods, you may be wondering how to create accounts using the OOBEINFO.INI method, but only make one of them Administrator. In principle, this is possible. Pay attention to the file useraccounts.cmd, which used the net user command in combination with the /add option to add accounts. To delete accounts, use the /delete parameter. In my example, I created Vadikan and Alex accounts. Let's say I want to move Alex from administrators to regular users. First, let's remove it from Administrators, and then add it to Users:

net localgroup Administrators "Alex" /delete
net localgroup Users "Alex" /add

These commands can be added to any batch file that will be executed upon first login.

We will assume that we have sorted out adding users. If you want to automatically install applications after the OS installation is complete, you need to organize automatic login under the desired user. Let's get on with it.

Automatic login

As usual, we will consider several options. Let's start with perhaps the simplest thing: all you need is to organize automatic login for the built-in Administrator account.

Built-in Administrator account

If you are not interested in other accounts (which I highly doubt;), then the easiest way is to use the answer file to automatically log in to the built-in Administrator account. In the answer file ( winnt.sif) you should have the following lines:


AdminPassword="mypassword"
EncryptedAdminPassword=No
AutoLogon=Yes
AutoLogonCount=2

In order, they mean the following: administrator password, whether the administrator password is encrypted (you can encrypt it using Setup Manager), automatic login, number of automatic logins (in Windows 2000, the maximum number of automatic logins is 2).

All you have to do is enter your password and set the desired number of automatic logins. All.

Other accounts

In truth, the methods described below are quite applicable to the built-in Administrator account. By the way, I recommend that you read the MS KB article Automating Windows Login before starting to study this section.

So, we want to import auto logon for the newly created user. You can automate the process of making changes to the registry different ways. We will look at importing from a *.REG file with the REGEDIT command, as well as the REG ADD command.

In the first edition of the article, only the *.REG file was considered, but several people had problems with the import, the nature of which remained unclear (in general, REGEDIT should work on the T-12). REG ADD solved the problem.

Importing from a *.REG file using the REGEDIT command

We will create a file autologon.reg, containing the registry parameters necessary for autologon, and then we organize the import of data using the REGEDIT command from useraccounts.cmd. Copy the following lines into Notepad

Windows Registry Editor Version 5.00


"DefaultUserName"="Vadikan"
"DefaultPassword"="asdf1234"
"AutoAdminLogon"="1"
"AutoLogonCount"=dword:00000001

The AutoLogonCount parameter specifies the number of automatic logons (in this case, one). Clear this option if you want to log in automatically all the time. Substitute your name and password, and then save the text as autologon.reg in the directory C:\XPCD\$OEM$\.

You should now have three files in the $OEM$ directory: cmdlines.txt, useraccounts.cmd And autologon.reg. Now you need to enter useraccounts.cmd command to import our registry settings. I think you already guessed how to do this - you just need to add the line

REGEDIT /S autologon.reg

This will ensure that the automatic login settings are imported into the registry.

REG ADD Command

In principle, REG ADD does the same thing as REGEDIT /S - imports required parameters to the register. In this case we do not need any additional files, and we'll just enter the commands directly into useraccounts.cmd:

REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /V DefaultUserName /t REG_SZ /D "Vadikan" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /V DefaultPassword /t REG_SZ /D asdf1234 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /V AutoAdminLogon /t REG_SZ /D 1 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /V AutoLogonCount /t REG_DWORD /D 1 /f

Remove last line if you want to log in automatically all the time. Substitute your username and password, and then add the resulting lines to useraccounts.cmd.

Important note! When organizing automatic login for other accounts, you need to make sure that the section is in winnt.sif contains only two lines related to the Administrator account:

AdminPassword=*
EncryptedAdminPassword=No

Remove everything else (eg. AutoLogon or AutoLogonCount). Replace the sprocket in AdminPassword password if you want to protect the Administrator account from unauthorized access.

It must be remembered that everything you indicate in winnt.sif(For example, AdminPassword), does not affect the Vadikan account described on this page. This only affects the built-in Administrator account.

Attention! Automatic login parameters specified in the file svcpack.inf, do not work. Use other methods described in this article.

If you did everything correctly, then during the installation of Windows at stage T-12 the file useraccounts.cmd will be launched from cmdlines.txt.

Other options for working with accounts.

This section is optional, but there may be situations in which the information below may be useful to you.

Renaming built-in accounts

Renaming built-in accounts is not necessary, but some do it for security reasons (an attacker will have to guess not only the password, but also the account name), or simply for convenience (Administrator is too long a name, especially for those who often have to enter it). It is possible to change the default usernames used in XP ( Administrator, Guest for localized version or Administrator And Guest for other versions). This can be done either from the command line or by changing one file in the distribution.

Renaming accounts from the command line

There are two tiny utilities - renuser.exe (10 kb) and netuser.exe (20 kb), using either of which you can solve the problem with one command. The utility must be placed in $OEM$\$$\system32\ and on the T-12 execute the command, for example, from the file cmdlines.txt.

"renuser Administrator NewName"
"NetUser Administrator /name:NewName"

The examples above rename the Administrator account.

Changing the defltwk.inf file

You can specify your own names for built-in accounts by editing the defltwk.inf file contained in the distribution package in compressed form. It's done like this (thanks, ):

  1. Finding the file i386\DEFLTWK.IN_ torName =
  2. We remove the comment before the name that we want to change (remove the ";") and set new values ​​after equals in quotes, for example.
    NewGuestName = "Type_guest"
    NewAdministra torName = "as_admin"
  3. * - Microsoft has a typo in the default name option Administrator, don’t forget to add the letter “r” between the letters “t” and “a” (highlighted in the example).
  4. Save changes
  5. We pack it back using the MAKECAB.EXE program (recommended) or put the unpacked file in a folder i386\, having previously removed the original from there ( DEFLTWK.IN_)

Add accounts interactively

Sometimes you need to quickly add an account or even do it on the T-12, and it is not known in advance what name and password the user needs and what group to place him in. To do this, you can use the program (download (173 kb),) made by a participant in the Oszone conference.

The program adds a user (using net user), changes the computer name (ComputerName parameter), user name (RegisteredOwner parameter), registers an autologon (AutoAdminLogon parameter) or simply makes the default user name (DefaultUserName parameter), and can also enter a command in RunOnceEx , understands any paths (local, UNC, global, variables).

A program similar in functionality recently made its way to MSFN - .

Conclusion

As you can see, accounts are quite large and important topic auto installations. However, in reality it turns out to be quite simple if you understand the mechanisms for creating accounts and autologin. Eat various options problem solving, as well as built-in Windows commands and utilities that will help with this.

Let's consider two simple ways Granting the account local administrator rights.

After you have created an account on Windows server Server, the question often arises, how to add a user to the local administrators group?

In this article we will show how to add a user to local administrators using the Windows Server 2012 R2 operating system as an example. All information applies to any other supported Windows operating systems. Naturally, to perform these operations, the account making these changes must have administrative rights.

Adding to the Administrators Group Using the Computer Management Console

Adding a user as an administrator using the net user command

Enter the operating room Windows system under an account that has administrator rights and launch an elevated command prompt.

To display a list of all local user accounts on the system, enter the command

As you can see, there are 6 accounts in the system.

To add the root user account to the local administrators group, run the following command and press Enter:

net localgroup administrators root /add

In Russian Windows versions local group administrators is called differently, so if the previous command returned the error “The specified local group does not exist,” use another command:

net localgroup "Administrators" root /add

If you need to add a domain user account to system administrators Active Directory, the command format will be like this:

net localgroup administrators yourdomain\root /add

You can check the composition of the local administrators group using the command:

Net localgroup administrators

As you can see, the root user account is now the server administrator.

NET USER - user account management

NET USER command intended for adding, editing or viewing user accounts on computers. When you run the command in the Command Prompt without parameters, a list of Windows user accounts present on the computer is displayed (this command also works well in Windows 10). User account information is stored in the Windows database.

NET USER Command Syntax

net user [username [password | *] [options]]

net user username (password | *) /add [options]

net user username , Where

  • Username- Indicates the name account user that can be added, deleted, edited or viewed. The name can be up to 20 characters long.
  • password- Assigns or changes the user password. Enter an asterisk (*) to display a password prompt. When entering from the keyboard, the password characters are not displayed on the screen.
  • /domain- Performs an operation on the main controller for of this computer domain.
  • options- Specifies a command line option for the command.
  • net help command- Displays help for the specified net command.
  • /delete - Deleting a user account.

Additional NET USER Command Options

  • /active:(yes | no) - Activates or deactivates an account. If the account is not activated, the user cannot access the server. By default, the account is activated.
  • /comment:"text" - Allows you to add a description of the user account (maximum 48 characters). The description text is enclosed in quotation marks.
  • /countrycode: nnn - Uses the country code specified for the operating system to implement the appropriate language files when displaying user help and error messages. A value of 0 is the default country code.
  • /expires:(date | never) - Account expiration date. The never value corresponds to an unlimited validity period. The date is specified in mm/dd/yy or dd/mm/yy format depending on the country code. The month can be indicated in numbers, in full or in abbreviated form (three letters). The year can be indicated with two or four digits. Date elements are separated by slashes (/) with no spaces.
  • /fullname: "name" - The user's full name (as opposed to the user account name). The name is indicated in quotation marks.
  • /homedir: path - Specifies the path to the user's home directory. The specified location must exist.
  • /passwordchg:(yes | no) - Indicates whether the user can change their password (the default is can).
  • /passwordreq:(yes | no) - Specifies whether the user account should have a password (the default is must).
  • /profilepath[:path] - Specifies the path to the user's login profile.
  • /scriptpath: path - Path to the script used by the user to log in.
  • /times:(time | all) - Time to login. The time parameter is specified in the format day[-day][,day[-day]],hour [-hour][,hour [-hour]], with an increment of 1 hour. The names of the days of the week can be indicated in full or in abbreviated form. Hours can be specified in 12- or 24-hour notation. For the 12-hour representation, the designations am, pm, a.m are used. or p.m. The value all indicates no restrictions on login time, and an empty value indicates no login at all. Days of the week and time values ​​are separated by a comma; Multiple entries for day of week and time values ​​are separated by semicolons.
  • /usercomment:"text" - Allows an administrator to add or edit a comment for an account.
  • /workstations:(computername[,...] | *) - Allows you to specify up to 8 computers from which the user can log into the network. If the /workstations parameter is not specified with a list of computers or is specified as *, the user can log on to the network from any computer.

NET USER Command Examples

  • To display a list of all users on this computer, use the command: net user;
  • To display information about the user "petr" use the following command: net user petr;
  • To add a Petr user account with a full username and the right to connect from 8 am to 5 pm Monday to Friday, use the following command: net user petr /add /times:Mon-Fri,08:00-17:00/fullname:"Petr".
  • To delete an account you must enter the command: net user petr /delete;
  • To turn off account you need to enter the command: net user petr /active:no.

Video - Working with the NET USER utility

Good afternoon, readers. Today, once again, I had to go searching for the necessary information. Often you have to help Windows users directly from the user account, and there are no tools at hand other than the one built into Windows cmd.exe command line. When working under a restricted account, you often need to perform some task with elevated Administrator rights. cmd for these tasks, the most suitable tool is that you do not have to enter the administrator password many times; you just need to run the command line once as an administrator and perform the necessary actions run the necessary commands which I will describe below:

appwiz.cpl- Installation and removal of programms
certmgr.msc- Certificates
ciadv.msc- Indexing service
cliconfg- SQL Network Client Program
clipbrd- Clipboard
compmgmt.msc- Computer management
dcomcnfg- DCOM component management console
ddeshare- DDE Shares (does not work on Win7)
desk.cpl- Screen properties
devmgmt.msc- Device Manager
dfrg.msc- Disk defragmentation
diskmgmt.msc- Disk management
drwtsn32- Dr.Watson
dxdiag- DirectX Diagnostic Service
eudcedit- Personal symbol editor
eventvwr.msc- Event Viewer
firewall.cpl- Windows firewall settings
gpedit.msc- Group Policy
iexpress- IExpress (I don’t know what it is)
fsmgmt.msc - Shared folders
fsquirt- Bluetooth File Transfer Wizard
chkdsk- Disk check (usually launched with parameters drive_letter: /f /x /r)
control printers- Printers and faxes - does not always start
control admintools- Computer administration - does not always start
control scheduled tasks- Scheduled tasks (scheduler)
control userpasswords2 - Account Management
compmgmt.msc- Computer management ( compmgmt.msc /computer=pc - remote control PC computer)
lusrmgr.msc- Local users and groups
mmc- creating your own equipment
mrt.exe- Malware removal
msconfig- System setup (autostart, services, etc...)
mstsc- Remote Desktop Connection
ncpa.cpl- Network connections
ntmsmgr.msc- Removable memory
ntmsoprq.msc- Removable RAM operator requests (for XP)
odbccp32.cpl- Data Source Administrator
perfmon.msc- Productivity
regedit- Registry editor
rsop.msc- Resulting policy
secpol.msc- Local security settings ( Local politics security)
services.msc- Services
sfc /scannow- Recovery system files
sigverif- File signature verification
sndvol- volume control
sysdm.cpl- Properties of the system
sysedit - System file editor (don't know what it is)
syskey - Account database protection
taskmgr- Task Manager
utilman Utility Manager
verifier Driver Verification Manager
wmimgmt.msc- WMI management infrastructure

This list is mainly GUI applications. Below I will highlight console commands in a separate list.

You can also run applications in the Control Panel with administrator rights by right-clicking while holding down the Shift key. And select Run as (RunAs...) (relevant for Win XP).

List of console commands:

nbtstat -a pc- username of the user working on the remote PC machine
net localgroup group user /add- Add user to the group group
net localgroupgroup user/delete- Remove user from group
net send pc ""text"" - send a message to a PC user
net sessions- a list of users
net session /delete- closes all network sessions
net use l: \\computer name\folder\- to plug network drive l: folder on the remote computer
net user name /active:no- block the user
net user name /active:yes- unblock the user
net user name /domain- information about the domain user
net user Name /add- add user
net user Name /delete- delete user
netstat -a- list of all connections to the computer
reg add- Add a parameter to the registry
reg compare- Compare parts of the registry.
reg copy- Copies from one partition to another
reg delete- Removes the specified parameter or section
reg export- Export part of the registry
reg import- Accordingly, import part of the registry
reg load- Loads the selected part of the registry
reg query- Displays the values ​​of a given registry branch
reg restore- Restores the selected part of the registry from a file
reg save- Saves the selected part of the registry
reg unload- Unloads the selected part of the registry
shutdown- shutting down a computer, you can turn off another one remotely.
SystemInfo /s machine- will show a lot of useful information about the remote machine



tell friends