AddUsers Automates Creation of a Large Number of Users (199878)



The information in this article applies to:

  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional
  • Microsoft Windows 2000 Datacenter Server
  • Microsoft Windows NT Server 4.0
  • Microsoft Windows NT Server, Enterprise Edition 4.0
  • Microsoft Windows NT Workstation 4.0

This article was previously published under Q199878

SUMMARY

The Addusers.exe tool for Windows is a 32-bit administrative utility that uses a comma-delimited text file to create, modify, and delete user accounts. Addusers is most beneficial when the information to be manipulated is maintained in a spreadsheet, such as one created with Microsoft Excel, that can be converted to a comma-delimited file. You must be a member of the Administrators group on the target computer to add accounts and a member of the Users group to write to accounts.

MORE INFORMATION

The AddUsers command uses the following syntax:

AddUsers {/c|/d{:u}|/e} filename [/s:x] [/?] [\\computername|domainname] [/p:{l|c|e|d}]
  • \\computername - is the computer where you want to create user accounts or from which you want to write user accounts. If you do not specify computername, AddUsers uses the local computer by default.
  • domainname - This option can be used in place of computername. If this option is used, then Addusers queries the PDC of the domain specified.
  • /c - Creates user accounts, local groups, and global groups as specified by filename.
  • /d{:u} - Dumps user accounts, local groups, and global groups to the specified file name. The (:u) is an optional switch that causes current accounts to be written to the specified file in Unicode text format. Choosing to dump current user accounts does not save the account's passwords or any security information for the accounts. To back up security information for accounts, a Tape Backup should be used.

    Note: Password information is not saved in a user account dump and if you use the same file to create accounts, all passwords of newly created accounts will be empty. All created users are required to change their password at logon by default.

  • /e - Erases the user accounts specified in the file name.

    CAUTION: Be careful when erasing user accounts, as it is not possible to recreate the user account with the same SID. This option, however, cannot erase built-in accounts.

  • Filename - The comma-delimited input/output file that AddUsers uses for data.
  • /s:x - This a optional switch that changes the character used for separating fields in the file. The x should be replaced with the new character to be used for separating fields. For example, /s:~ would make the field-separation character the "~" (tilde). If this option is not specified, the default separator, a comma, is used.
  • /? - Displays a help screen.
  • If you are using Windows NT 4.0, the newer version of Addusers.exe is available in the Windows NT Resource Kit, Supplement 3, has added a /p switch. This switch increases functionality when creating new users with AddUsers.exe in Windows NT.
  • /p: - Sets account creation options. It can be used along with any combination of the following options:

    • l - Users do not have to change passwords at next logon.
    • c - Users cannot change passwords.
    • e - Passwords never expire. (implies l option)
    • d - Accounts disabled.

    Sample: Creating New Users and Groups with Addusers

    1. Log on as a user who is a member of the Administrators group of the target computer.
    2. Create a comma-delimited text file, which contains the new users and groups to be created. Syntax is section-specific for each entry (line) in the different sections, as follows:

      [Users]
      User Name,Full name, Password, Description, HomeDrive, Homepath, Profile, Script

      [Global]
      Global Group Name, Comment, UserName, ...

      [Local]
      Local Group Name, Comment>, UserName, ...

      The entries (lines) in the [Local] and [Global] group sections can have 0 or more UserName entries after the comment field. Each user name is added to that group. Lines must end with a comma (or the appropriate separator character). Here is the example from the Resource Kit Tools Help file for AddUsers.exe:

      [User]
      jimmy,James Edward Phillip II,,,,,,
      alex,Alex Denuur,,,E:\,E:\users\alex,,
      ron,Ron Jarook,hello,,E:\,E:\users\ron,,
      sarah,Sarah Selly,,,,,,
      mike,Mike Olarte,,,,,,

      [Global]
      TestTeam,Regression,ron,alex,
      DevTeam,Conversion to Sources,mike,sarah,jimmy,

      [Local]
      UsersAM,Users A through M,alex,jimmy,mike,
      UsersNZ,Users N through Z,ron,sarah,
    3. Save the file.
    4. Creating the users (and groups) can be performed through a batch file or at the command line. The following command creates the users and groups listed in a text file called Users.txt. The "/p" switch creates the users with the Passwords Never Expire option enabled:

      C:\>AddUsers [\\computername] /c c:\Users.txt /p:e

      Alternatively, using a domain name, the syntax would be:

      C:\>AddUsers [domainname] /c c:\Users.txt /p:e

    Sample: Generating a List of User Accounts and Groups from a Computer Running Windows

    1. Log on as a user who is a member of the Administrators group of the target computer.
    2. At a command prompt, type Addusers \\servername /d filename.txt (where servername is the name of a domain controller, member server, or workstation), and then press Enter.
    With appropriate permissions, administrators can generate a list of users from domains other than their own. The list is generated into the filename.txt text file. This file also contains information such as the profile, home directory, and scripts for each user. The NET USERS command also permits modification, deletion, and creation of accounts, but lacks some of the features of Addusers.exe.

    For additional information about creating batch files to automate the creation of users, please see the following article in the Microsoft Knowledge Base:

    180546 Automating Updates to Local Groups on Member Servers

REFERENCES

The AddUsers.exe utility and additional documentation is included in the Windows Resource Kit.

Modification Type:MajorLast Reviewed:5/14/2003
Keywords:kbinfo KB199878