JSI Tip 0094 - Adding multiple user accounts.
March 19, 1997
Below you will find a batch file which provides a simple method of adding multiple user accounts. This batch file does not make use of any non-standard commands. I personally use the resource kit utilities which allow assigning the new user to a group and setting share permissions, but the enclosed batch file does everything else. (You can add a net group command - see %systemroot%System32tcmds.hlp)
Usage: Create a batch file of about 50 entries per the following example:
echo **>>c:usersJSIAddErrors.log
call JSIAddUser User1 User1Password "Remarks" "User1 Full Name" HomeServer
call JSIAddUser User2 User2Password "Remarks" "User2 Full Name" HomeServer
exit
Requirements:
1. The batch file must be run on the HomeServer.
2. Users home directories are created as hidden shares on HomeServer in C:USERSUserName.
A login script will issue a net use Drive: /home
3. Permissions on C:USERS are set for Administrators and Backup Operators only.
4. Common files in C:USERSdefault are copied to the users home directory.
5. An cummulative log file of errors is created as C:USERSJSIAddErrors.log.
JSIAddUser.cmd
REM JSIAddUser.cmd
REM Usage is Call JSIAddUser UserName Password "Remarks" "FullName" HomeServer
if "%5" == "" goto parms
if exist c:users%1 goto dup
md c:users%1 >nul
net user %1 %2 /ADD /comment:%3 /fullname:%4 /homedir:\%5%1$ >nul
if errorlevel 1 goto dup
net share %1$=c:users%1 /Y>nul
CACLS c:users%1 /G %1:F /T /E >nul
xcopy c:usersdefault*.* c:users%1 /s /e>nul
goto fin
:dup
Echo %1 and/or c:users%1 pre-existing. >>c:usersJSIAddErrors.log
goto fin
:parms
Echo number of parameters for %1. >>c:usersJSIAddErrors.log
:fin
See tip 443 for a freeware user wizard.
About the Author
You May Also Like