You are currently offline, waiting for your internet to reconnect

Batch Process to Create and Grant Access to Home Directories

This article was previously published under Q155449
This article has been archived. It is offered "as is" and will no longer be updated.
When administrators need to create large numbers of users and correspondinghome directories, the task can be simplified by using a batch processrather than creating each home directory individually through Windows NTFile Manager or Windows NT Explorer.
Here is an example of a batch process that will create the home directoryand 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. Thesecond command starts with rmtshare, and should be on one line in the batchfile.

The first command creates the directory for the user where <username>represents the user. An environment variable could be used hereto represent the user. Usernames could then be pulled from a list ofusers 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 /GRANTswitch gives full control to the user <username> and full control to theadministrator account. The /REMOVE switch removes permissions from theEveryone Group. Again, the user could be respresented by an environmentvariable.

NTFS permissions could be modified in the same batch process through theCACLS 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"
security login logon home dir rmtshare.exe reskit 4.0

Article ID: 155449 - Last Review: 12/04/2015 15:18:38 - Revision: 2.2

Microsoft Windows 2000 Server, Microsoft Windows 2000 Advanced Server, Microsoft Windows NT Server 3.5, Microsoft Windows NT Server 3.51, Microsoft Windows NT Server 4.0 Standard Edition

  • kbnosurvey kbarchive kbenv kbinfo kbnetwork KB155449