Batch Process to Create and Grant Access to Home Directories

Last reviewed: February 4, 1998
Article ID: Q155449
The information in this article applies to:
  • Microsoft Windows NT Server versions 3.5 and 3.51

SUMMARY

When administrators need to create large numbers of users and corresponding home directories, the task can be simplified by using a batch process rather than creating each home directory individually through Windows NT File Manager or Windows NT Explorer.

MORE INFORMATION

Here is an example of a batch process that will create the home directory and the share, and will assign permissions. This example uses RMTSHARE, from the Windows NT 3.51 Resource Kit.

   md c:\users\<username>
   rmtshare \\<HomeServer>\<username>$=c:\users\<username>
         /grant <username>:f /grant administrator:f
         /remove everyone

NOTE: There are two commands here. The first command starts with md. The second command starts with rmtshare, and should be on one line in the batch file.

The first command creates the directory for the user where <username> represents the user. An environment variable could be used here to represent the user. Usernames could then be pulled from a list of users created by ADDUSERS -D, for instance.

The second command creates the share on <homeserver>. The dollar sign ($) at the end of the user name share name creates a hidden share. The /GRANT switch gives full control to the user <username> and full control to the administrator account. The /REMOVE switch removes permissions from the Everyone Group. Again, the user could be respresented by an environment variable.

NTFS permissions could be modified in the same batch process through the CACLS command.

The syntax of the RMTSHARE command is:

 RMTSHARE \\server
          \\server\sharename
          \\server\sharename=drive:path [/USERS:number | /UNLIMITED]
                               [/REMARK:"text"]
                               [/GRANT [user[:perm][ /GRANT user[:perm]]]]
                               [/REMOVE user]
          \\server\sharename=printername /PRINTER [/USERS:number |
           /UNLIMITED]
                               [/REMARK:"text"]
                               [/GRANT [user[:perm][ /GRANT user[:perm]]]]
                               [/REMOVE user]
          \\server\sharename [/USERS:number | /UNLIMITED]
                               [/REMARK:"text"]
                               [/GRANT [user[:perm][ /GRANT user[:perm]]]]
                               [/REMOVE user]
          \\server\sharename /DELETE

NOTE: If a sharename or path contains spaces, it should be enclosed
      in quotes: \\server\"with space"="c:\with space"


Additional query words: security login logon home dir rmtshare.exe reskit
4.0
Keywords : ntdomain kbenv kbnetwork
Version : WinNT:3.5,3.51
Platform : winnt
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 4, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.