[THIN] Re: Easier way to do this

  • From: "Abraham Pearson" <apearson@xxxxxxxxxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Tue, 6 Jul 2004 09:07:29 -0700

> -----Original Message-----

> I need to change NTFS permissions on 125 directories. Assigning only the
> user to each one and removing admins etc.  Is there a way to do this with
> a script or command line using a variable such as %username%, or
> something?
>  
> Thanks,
>  
> Michael Boggan

Here's how I apply permissions to user's folders in a departmental hierarchy :

File 1:
********************************
rem %1 should be the root directory which contains department folders.
rem In this case the folder "users" exists in each departmental directory and 
contains
rem the users files.
rem I also have a departmental director group for every department.
dir %1 /A:D /B > %temp%\deptdir.txt
for /F "delims= tokens=1" %%f in (%temp%\deptdir.txt) do call 
\\server\path-to-second-script.cmd j:\%%f\users "%%f director":c 
********************************
File 2:
********************************
@echo off

IF "%1"=="" GOTO NoArgs
Echo Creating directory listing for "%1"
dir "%1" /A:D /B > dir.txt
for /F "delims= tokens=1" %%a in (dir.txt) do call 
\\server\path-to-third-script.cmd %1 %%a %2 %3
echo ---------
echo - Finished.
echo ---------
GOTO End
:NoArgs
ECHO usage: ADDPERM [Drive:\Directory of Users Parent Folder] ["additional user 
or group":{C(or)F(or)R}]
ECHO                              C = Change; F = Full; R = Read
ECHO.
:End
********************************
File 3:
********************************
@Echo off
rem %1 will be the path above the target directory, %2 will be the directory 
name
rem and %l will be the path to the netlogon directory on the logon server
rem copied from Microsoft's Website and modified

echo Running addperm2 for folder %1\%2 giving rights to %2 and %3

if "%2"=="bytes" GOTO :End

REM Prefix %2 with the domainname\ if applying permissions to workstations or 
REM member server and place Quotes if groups contain a space.

cacls "%1\%2" /T /G  CORP\%2:C  FSOne_FileAdmin:F system:f "CORP\Domain 
Admins":F  %3 %4 < \\server\path-to-a-file-with-y-in-it.txt 
>\\server\path-to-trash-receptacle.txt

:End
********************************
********************************************************
This weeks sponsor Emergent Online Thinssentials Utilities
Using the latest software, hardware, networking technologies, proven technical 
expertise, proprietary software and best practices, EOL provides 
custom-tailored solutions for each client?s mission and specific goals.
http://www.go-eol.com
**********************************************************
Useful Thin Client Computing Links are available at:
http://thin.net/links.cfm
***********************************************************
For Archives, to Unsubscribe, Subscribe or
set Digest or Vacation mode use the below link:
http://thin.net/citrixlist.cfm

Other related posts: