Subscribe to Windows IT Pro
February 01, 1998 12:00 AM

Reader to Reader - February 1998

Windows IT Pro
InstantDoc ID #2959
Rating: (0)
Downloads
drivespace.zip

1. Create the user list. Open a spreadsheet in Excel, and enter the necessary information in Sheet1. Here is what goes in each column:

Column A contains the user IDs. In row 1 of column A (cell A1), enter:

[User]

In A2, enter the formula:

=CONCATENATE(MID(B2,SEARCH(" ",B2)+1,5),LEFT(B2,1))

Don't forget the space between the two quotation marks. This formula generates the standard six-character user ID. (You can modify this formula to suit your user ID needs, but you'll have to refer to Excel's online Help for assistance.) Leave the rest of the column blank for now.

Column B contains the usernames. In B2, begin entering the full names (first name, then last name) for all the new users. You can either type this information or import a text file if one is available. Fortunately, after you have entered the full names, most of your work is done because you will generate the rest of the information from this column of names.

After entering the usernames, use Excel's AutoFill feature to copy the formula you put in A2 to the rest of column A. In seconds, you will have all your users' IDs in the first column.

Column C contains the users' initial password. You can specify an initial password, or you can leave this field blank.

Column D contains the user profiles. In the NT environment, a user's profile is the same as the user's full name, so enter this formula in D2:

=B2

Use AutoFill to copy the formula to the rest of the column.

Column E contains the drive letter for the user's home directory. All my users use the U: drive, so I entered this formula in E2:

U:

Then I used AutoFill to copy this entry to the rest of the column.

Column F contains the path to the user's home directory. The NT environment follows the convention \\SERVER\<user ID>$ where $ specifies that the share to connect to is a hidden share. The formula for column F is:

=CONCATENATE("\\SERVER\",A2,"$")

Enter this formula in F2, and use AutoFill to copy this entry to the rest of the column.

Column G contains the path where the user's profile will reside. Because the profiles will be in the same directory on the server, enter this formula in G2:

=\\SERVER\profiles

Use AutoFill to copy this path to the rest of the column.

Column H contains the name of the logon script to run for the user. All my users use the same file (logon.bat), so in H2, I entered logon.bat and used AutoFill to copy this file to the rest of the column.

After you finish entering the information in the columns, save your work in Excel format. Screen 2 shows an example of what the worksheet will look like. Then save your worksheet as a comma-delimited text file by choosing CSV (Comma delimited) in the Save As dialog box. Screen 3 shows an example of a comma-delimited file. Make sure that [User] appears before the list of names. (Note: The ADDUSERS utility that comes with the NT 4.0 resource kit differs from the utility that comes with the NT 3.51 resource kit. I used the 4.0 utility. Check your NT resource kit for information about your ADDUSERS utility, including details on the format for the text file.)

2. Run the command. At the server where you will create the users (the Primary Domain Controller—PDC—in a domain environment), run the following command:

addusers /c <users.txt>

Replace users.txt with the filename that you used in Excel to save the file.

ADDUSERS will now create NT user IDs based on the information in your text file. For each user, you will receive a confirmation that ADDUSERS created the ID. You will also receive an Error: 53 message because the home directories that ADDUSERS is trying to add to the users' profiles do not yet exist. You'll create these directories shortly, so you can ignore these error messages for now.

You might receive another error message warning you of duplicate user IDs. The formula you used in Excel doesn't check for duplicate IDs. So, for example, John Smith and Jack Smith would generate the same user ID of SmithJ. ADDUSERS will give you an error message when it tries to create the second ID. You must change duplicate IDs manually.

3. Create the home directories. You can use your Excel worksheet of users to quickly generate a new worksheet that contains the required commands to create the directories. To begin, create a USERS directory off the root of a drive on the NT server where the home directories will reside. If the USERS directory is on an NTFS partition, give the Administrators group full control to this directory.

Next, open the Excel spreadsheet that contains the user list. Go to Sheet2. In A1 of Sheet2, enter:

=CONCATENATE("@echo off")

In A2, enter:

=CONCATENATE("if not exist
   e:\users\",'Sheet1'!A2," md
   e:\users\",'Sheet1'!A2)

(Don't forget the space before md.) For user John Smith, this formula will generate the command:

If not exist e:\users\SmithJ md e:\users\SmithJ

Use the AutoFill to copy this formula to the rest of the column.

Save Sheet2 as a text file (tab delimited), and give it a name such as makedirs.txt. Then rename the file from makedirs.txt to makedirs.bat. (Unfortunately, in Excel 97, you have to go through these awkward steps because Excel tries to append a .txt extension to all filenames, regardless of whether you already assigned another extension.) Run the batch file to create your directories.

4. Set permissions on the home directories. If the user directories are on an NTFS partition, you need to set the proper permissions on the directories. If the home directories are not on an NTFS partition, you can proceed to step 5.

The process for setting permissions is similar to the one you used to create the home directories. You will be using a batch file and the resource kit utility cacls.exe. (For details on the CACLS command, type CACLS /? at the command line or see the NT resource kit.)

In your Excel spreadsheet, go to Sheet3. In A1, enter:

=CONCATENATE("@echo off")

In A2, enter:

=CONCATENATE("cacls e:\users\",'Sheet1'!A2," /T /E /C /G ",'Sheet1'!A2,":C")

Change the drive letter in the formula to the drive that you are using in your environment, and don't forget the space before the /T and after the /G. For John Smith, this formula creates the command line:

cacls e:\users\SmithJ /T /E /C /G SmithJ:C

This command gives John Smith Change control to his home directory. Use AutoFill to copy this formula to the rest of the column.

Save Sheet3 using the same procedure that you used to save Sheet2. Run the generated batch file to set the proper permissions on the user directories.

5. Share the home directories. Now you must share the users' directories and set the proper share-level permissions for the directory. You will be using the batch file and the NT resource kit utility, rmtshare.exe. The syntax for this command is:

rmtshare
   \\server\[\sharename\[=path [/printer]]]
   [/grant [user\[:perms ]]] [/remove user][/users:number]
   [/unlimited] [/remark:"text"] /delete]

Add a new worksheet in Excel (Sheet4). In A1, enter:

=CONCATENATE("@echo off")

In A2, enter:

=CONCATENATE("rmtshare ",
   Sheet1!F2,"=e:\users\",Sheet1!A2," /grant ", Sheet1!A2,":C")

Don't forget the space after rmtshare and before and after /grant. For John Smith, this formula creates the command:

Rmtshare \\SERVER\SmithJ$=e:\users\SmithJ /grant SmithJ:C

This command creates a hidden share because the share name ends with a $.

Save Sheet4 as a text file and rename it to a file with a .bat extension. Run this batch file to create all your shares with the proper permissions.

Now that you're finished, don't delete the Excel spreadsheets or the text files. They could come in handy if your server crashes and you must re-create all the accounts. In addition, if you have an existing NT environment, you can run ADDUSERS with the /d option so that you'll have a snapshot of your user database in case disaster strikes.

This five-step procedure automates the process of creating and setting up numerous users, saving you many hours of work. Although someone must enter each user's name into the spreadsheet, you can pay someone to enter the names, saving you even more time.

Related Content:

ARTICLE TOOLS

Comments
  • Greg
    10 years ago
    Mar 05, 2002

    Hi,
    I'm wondering if any has messed much with addusers.exe and CSV files.
    Here's my theory.
    C:\\>addusers /d C:\\AddusersMT.csv \\\\DomainController
    This dumps all users to a CSV file minus passwords. (CSV FIles are excellent for creating scripts. IE, column 1 == command, column 2 == switch. Open CSV file in a text editor, find and replace commas with a space to create the script.)
    Anyway, create the addusers dump to a csv file.
    Get a copy of your sam file off your NT server. (SYSKEY is enabled by default on 2000 Server but not on NT Servers, post SP4. If you find SYSKEY is enabled on your NT Server, you cannot undo this. The SAM file are encrypted to a 128Bit algorithm and can't be cracked in a reasonable time with a cracker like l0pht Crack.
    If SYSKEY is enabled, create a BDC for the domain and crack that SAM file. (IT's not SYSKEYed)
    In the ADdusers dump, sort by name. DO the same with the l0pht Crack dump. Copy the password column to the password column in the Adduser script you're creating.
    Run Addusers /c on the domain target domain controller. /C creates the accounts with the password field populated with the NT domain passwords.

    This is my theory, I hope it works because I won't want a plant full of common passwords.

    Also, consider Active Directory Migration Tool (ADMT) Google that, you'll find some good references. DOwnload it from Microsoft for free.

    It's good for migrating trusts, groups, accounts but there are limitations to password migration.
    It only lets you reset all passwords to the user name or create some bastardized password like @)(!h4D)4D.!~~

    Anyway, I'd be interested to hear if anyone has done this.
    Write to me:
    Greg
    zzsql@REMOVETHIS-hotmail.com.

    www.NetworkIQ.net

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.