| T.R | Title | User | Personal Name
 | Date | Lines | 
|---|
| 5784.1 |  | TARKIN::LIN | Bill Lin | Fri Mar 07 1997 11:15 | 3 | 
|  |     re: STAR::PITCHER
    
    ADDUSERS.EXE in the NT resource kit?
 | 
| 5784.2 | free CD-ROM from Microsoft does it! | ACISS2::SELLIS |  | Sat Mar 08 1997 21:56 | 12 | 
|  |     In addition the Feb. k-12 tech newsletter for schools mentions
    a free CD-ROM for schools with the purchase of NT 4.0 server.
    It include a utility to import a comma deliminated ascii file
    from a existing schools database to add multiple users in a 
    batch fashion.
    
    I've only read about it and not seen it or tried it, but you
    may want to call Microsoft and check in to it.  The Feb. K-12
    newsletter is on Microsofts Web page, and can be subscribed to
    if you are interested.
    
    
 | 
| 5784.3 | NET USER? | PGREEN::SACKMANJ | Pedalo'ing the Internet | Tue Mar 11 1997 00:23 | 8 | 
|  |     There is a command line interface to USER MANAGER:
    
    c:\> NET USER params
    
    Try NET HELP USER or NET USER /?
    
    	Jon.
    
 | 
| 5784.4 | Here's a nice place to start | SWAM1::FRANK_BR | The Dr. is in. | Tue Mar 11 1997 10:23 | 168 | 
|  |     Here's a Batch file I'm working on for a customer (ie: it's specific
    to the way we're implementing NT, Roaming, ...). But it should
    prove to be a good starting place. FYI, the NetAccess program is based
    almost totally on the Windows NT 4.0 SDK sample AclApi that is included in
    VC++. The NetShare program is also based on a Sample from the SDK.
    NetShare is was needed because we need to be able to run the procedure
    remotely and the Standard Net Share does not work for remote machines.
    
    Warning: This is a work in progress (like I was up 'till 3:00 last
    	     night putting it together). It probably has a problem or two.
    
    -------------------------------------------------------------------------
    @echo off> Nul
    rem +++
    rem     AddUser.Bat             Brock Frank             10-Mar-1997
    rem                             Digital Equipment Corp.
    rem
    rem     This procedure is used to create a user account in the current 
    rem     domain and setup their home directory, Share, and profile.
    rem 
    rem     Sytnax:
    rem
    rem     adduser <username> <fullname> <comment> <loginscript> <Domain>
    rem
    rem     HomeDirSystem   file server hosting Users M: Drive (Personal Share)
    rem
    rem     HomeDirPath     Path to root on file server for personal 
    rem                     share (ex: J:\Users) directories.
    rem
    rem     ProfilePath     Path to Template profile
    rem
    rem     ForceProfile    If set, Procedure will copy the specified profile regardless
    rem                     if one exist.
    rem
    rem     Assumtions: 
    rem     
    rem     1) HomeDirPath on file server is shared as Users$
    rem
    rem ---
    rem
    rem     Check that we have all are parameters
    rem
    if @%1==@ goto SyntaxMessage
    if @%2==@ goto SyntaxMessage
    if @%3==@ goto SyntaxMessage
    if @%4==@ goto SyntaxMessage
    rem
    rem     Set defaults
    rem
    if not defined HomeDirSystem set HomeDirSystem=\\Spanky
    if not defined HomeDirPath set HomeDirPath=J:\Users
    if not defined ProfilePath set ProfilePath=\\Spanky\Default$
    if @%5==@ set Domain=%USERDOMAIN%
    rem
    rem     Try to create the users account. 
    rem
    @echo.
    @echo
    --------------------------------------------------------------------
    @echo.
    @echo            Adding %1 user account to domain %Domain%
    @echo.
    NET USER %1 testing /fullname:%2 /comment:%3 /homedir:%HomeDirSystem%\%1$ /profilepath:%HomeDirSystem%\%1$\Profile /scriptpath:SMSLS /Expires:0 /domain /add > NUL
    if %ERRORLEVEL% GTR 0 goto AccountAddFail
    rem
    rem     Create Home Directory
    rem
    :CreateDirectory
    if exist %HomeDirSystem%\Users$\%1\Profile goto DirExist
    @echo  Creating home directory %HomeDirSystem%\Users$\%1. 
    @MkDir %HomeDirSystem%\Users$\%1\Profile
    if %ERRORLEVEL% GTR 0 goto HomeDirFail
    :DirExist
    @Echo  Home directory already exist. Continuing...
    rem
    rem     Grant permissions to User on FileSystem
    rem
    :GrantDirPerms
    @echo  Granting Permissions to %1 on home directory tree
    %HomeDirSystem%\%1 
    cacls %HomeDirSystem%\Users$\%1 /T /E /P %Domain%\%1:F "%Domain%\Domain Admins:F" /R Everyone /C > nul
    if %ERRORLEVEL% GTR 1 goto PermFail
    @net use %HomeDirSystem%\%1$  > NUL
    if %ERRORLEVEL% LEQ 1 goto ShareExist
    @echo  Sharing Users Home Directory
    @netshare %HomeDirPath%\%1 %1$ %Domain%\%1 %HomeDirSystem%
    if %ERRORLEVEL% GTR 1 goto ShareHomeDirFail
    goto SetAccess
    :ShareExist
    @echo  Share already exist. Continuing...
    @echo  Granting Permissions to %Domain%\Domain Admins on Share %HomeDirSystem%\%1$.
    @Net Use %HomeDirSystem%\%1$ /d > NUL
    :SetAccess
    NetAccess %HomeDirSystem%\%1$ /Grant "%Domain%\DOMAIN ADMINS"
    if %ERRORLEVEL% GTR 1 goto PermFail
    @echo  Granting Permissions to %1 on Share %HomeDirSystem%\%1$.
    NetAccess %HomeDirSystem%\%1$ /Grant %Domain%\%1 
    if %ERRORLEVEL% GTR 1 goto PermFail
    @echo  Revoking Permissions to Everyone on Share %HomeDirSystem%\%1$.
    NetAccess %HomeDirSystem%\%1$ /revoke EVERYONE  
    if %ERRORLEVEL% GTR 1 goto PermFail
    @Echo  Coping Template profile %ProfilePath% to
    %HomeDirSystem%\%1$\Profile.
    rem
    rem ******** Add Check for ProfileForce flag **********
    rem
    xcopy /s /v /e %ProfilePath% %HomeDirSystem%\%1$\Profile > NUL
    if %ERRORLEVEL% GTR 1 goto ProfileFail
    @Echo.
    @Echo                   Successfully Created %1 ...
    goto exit
    :ProfileFail
    @Echo.
    @Echo   Failed to copy profile %ProfilePath% to
    %HomeDirSystem%\%1$\Profile.
    @echo.
    goto exit
    
    :PermFail
    @Echo.
    @Echo   Failed to set share permissions for %DirRoot%\%1
    @echo.
    goto exit
    :ShareHomeDirFail
    @echo.
    @echo   Failed to share users home directory.
    @echo.
    goto exit
    :HomeDirFail
    @echo.
    @echo   Failed to create users home directory.
    @echo.
    goto exit
    :AccountAddFail
    @echo.
    @echo   NET USER command failed for unknown reason. The error message Proceeds this.
    @echo   Continuing...
    @echo.
    goto CreateDirectory
    :SyntaxMessage
    @echo.
    @echo     adduser username fullname comment loginscript domain
    @echo.
    @Echo     Domain will default to %USERDOMAIN%.
    @Echo.
    @Echo     The Following Environment Variables are used:
    @Echo.
    @Echo     HomeDirSystem   file server hosting Users M: Drive (Personal Share).
    @Echo                     User Executing this procedure must have Admins rights on Server.
    @Echo.
    @Echo     HomeDirPath     Path to root on file server for personal 
    @Echo                     share (ex: J:\Users) directories.
    @Echo.
    @Echo     ProfilePath     Path to Template profile
    @Echo.
    @Echo     ForceProfile    If set, Procedure will copy the specified profile regardless
    @echo                     if one exist
    @echo.
    @Echo     Assumptions: 
    @Echo.
    @Echo     1) HomeDirPath on file server is shared as Users$
    @Echo.
    goto Exit
    :Exit
    @echo.
    @echo
    ------------------------------------------------------------------------
    
 | 
| 5784.5 | Thanks. | STAR::PITCHER | Steve Pitcher/Pathworks for OpenVMS | Tue Mar 11 1997 13:38 | 4 | 
|  |     Thanks all.  That's all good looking stuff.  I'm going to check out
    each of these replies.
    
    -	stp
 |