User management on a grand scale

Systems administrators who need to create or delete hundreds or thousands of Windows NT user accounts en masse must appreciate addusers.exe, a command-line tool that comes in Microsoft Windows NT Server 4.0 Resource Kit. If you have a database of users whom you want to add or delete accounts for, AddUsers provides an automated alternative to the User Manager. You control AddUsers through simple, comma-delimited ASCII text files.

Creating an Account
To create accounts, you must first create an ASCII text file that lists the users you want to add. The first line of the file must contain the word user, in brackets. The file's following lines must each contain information about one user whom you want to create an account for. The user lines need to list the username, user full name, password, description, home drive letter, home drive Uniform Naming Convention (UNC), profile location, and logon batch script, in that order.

For example, suppose I want to create an account for a user whose username is marty, full name is Martin Jones, password is opensesame, and description is writer. Further, suppose Marty connects his local H drive to \\server1\users\marty, which he uses as a home directory; he stores his profile in \\server1\users\marty\profile; and he runs start.bat for his logon. I create an ASCII file for Marty and call it add1.txt. It looks like

\[user\]
marty,Martin Jones,opensesame,
Writer,H:,\\server1\usersmarty,\\server1\users\martyprofile,start.bat

In the ASCII file, each user's information must appear on one continuous line; press Enter only to begin entering information about a new user. In addition, make sure that you don't add spaces after the commas. If your file includes a space between a comma and a piece of user information, AddUsers will include the space in the user information.

After I create the necessary ASCII file, I must tell it to execute. AddUsers' /c option creates user accounts, so I open a command prompt and type

addusers /c add1.txt

AddUsers' Options
You can give a user a local path instead of a home directory; just leave the home drive letter field empty and specify the local path in the home drive UNC field. For example, if I want Marty's default path to be his local C drive, I make his user line

marty,Martin Jones,opensesame,Writer,,C:\,
\\server1\users\marty\profile,start.bat

You can also create groups with AddUsers. To create a global group, add a section to your ASCII file named global and a line for each global group you want to create. Each global group line must contain the global group name, a comment about the global group, and the username for each user you want to include in the group. (The resource kit documentation says you must end each line with a comma, but I've found this comma is not necessary.) I can create a global group called WriterGuys that includes accounts for users mark and marty and the comment Guys Who Write by adding the following lines to my ASCII file:

\[global\]
WriterGuys,Guys Who Write,mark,marty

You create local groups the same way you create global groups, except that you name the section local, not global.

Finally, you can use AddUsers' /e option to delete user accounts. Create an ASCII text file with the word user (in brackets) on the first line, and list the usernames of users you want to delete on the following lines. Place one username on each line, and follow each username with seven commas. When you've created your ASCII file (e.g., kill.txt), tell AddUsers to delete the users by opening a command prompt and typing

addusers /e kill.txt

You can't control every aspect of user accounts through AddUsers: You can't specify logon hours, an account expiration date, or restrictions on which workstations a user can access. You can't use AddUsers to change user information in existing user accounts and groups, either. If you include the username or group name for an existing user or group in an AddUsers ASCII file, you'll get an error message. Nevertheless, AddUsers is a time-saving alternative to NT's User Manager that makes bulk operations easier to perform.