On Wed, Apr 02, 2003 at 06:57:49PM -0500, Chris H said:
> if I have, say a directory with 400 User folders in it, is there a way to
> script permissions to apply only:
> 
> domain admins and the user who's user directory it is to avoid having to
> indivdually set them all?
> 
> if so, how?

I once wrote the following batch script so I could create user's home
directories properly, because NT4 is incapable of doing it on its own.

There is a file called "YES.TXT" which contains a "Y" symbol, because for some
reason I couldn't pipe that command through an "ECHO Y" command.

You may be able to adapt this somehow to using a text file.  The original
version I wrote required a text file for input, however I changed it to allow
input from the command line, because it suited my needs better.


@ECHO OFF
REM ECHO CREATE.CMD
REM Created 18/08/02 by Adam Smith
REM
REM Description:
REM
REM Creates home directory based on parameters.
REM Adds correct permissions, and shares directory for mapping.

REM ==============================================================------------------
REM Check Command Line Parameters
REM ==============================================================------------------

IF "%1"=="" GOTO USAGE

:LOOP
IF "%1"=="" goto END
ECHO ==============================================================------------------

REM ==============================================================------------------
REM Create directories
REM ==============================================================------------------

ECHO Creating Directory %1
MKDIR %1

REM ==============================================================------------------
REM Add user permissions to directories
REM ==============================================================------------------

ECHO Adding Access Permissions for %1
cacls %1 /T /G Administrators:F DOMAIN\%1:C "DOMAIN\Domain Admins":F<YES.TXT

REM ==============================================================------------------
REM Share user directories as per USERS.TXT
REM ==============================================================------------------

ECHO Sharing %1 as %1$
NET SHARE %1$=D:\USERS\%1

SHIFT
GOTO LOOP

:USAGE
ECHO CREATE will create user home directories and share them over the network.
ECHO You can create as many as you like.
ECHO.
ECHO CREATE username1 username2 username3 . . .
ECHO.
ECHO --EXAMPLES:
ECHO.
ECHO CREATE tim mary ryan
ECHO.
ECHO The above command will create the directories tim, mary and ryan, give them
ECHO appropriate access permissions, and share them.
ECHO.

GOTO END

:END




-- 
Adam Smith
Information Technology Officer
SAGE Automation Ltd.

[EMAIL PROTECTED]
http://www.sageautomation.com

------
You are subscribed as [EMAIL PROTECTED]
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to