Re: Script to set folder security by Roger
Roger
Sun May 01 09:56:42 CDT 2005
Sure this is possible.
One could use a Wsh language like Vbscript, instance the
filesystem object, then get object for the root folder of
which you are concerned.
(BTW, if you set here inheritable NTFS security to carry
all that is the same for all subfolders, like Administrators
Full control, then you would have a tighter end result).
In the script, from the folder object you would get the
subfolders collection, and then for each of them it is
just going through a loop to parse out the account that is
correct for the folder and then, most simply, shelling out
to a cacls execution using the /e /t /g flags.
See cacls /?
Other than shelling out to cacls, it us possible to use WMI,
adSecurity.dll, or third-party additions like setacl that could
be used.
There is a microsoft.public.windows.server.scripting
newsgroup if the hint of using cacls is insufficient . . .
--
Roger Abell
Microsoft MVP (Windows Security)
MCSE (W2k3,W2k,Nt4) MCDBA
"Stephen Bloomer" <StephenBloomer@discussions.microsoft.com> wrote in
message news:8C2C05FA-E0AD-4C96-A00E-05B473C37944@microsoft.com...
> I recently moved the home folders for 900 students to a new 2003 server
and
> when I did I messed up all the folder security settings. The folders name
is
> based on the users login name. Is there a way to run a script that would
> read the folders name and then set the folders security to give that user
> full permission, and give a number of other security groups permission at
the
> same time? E.g. user:F Domain Admins:F System:F and teaching:F