For example http://support.microsoft.com/kb/180464 details the old script method we use.
Hope this helps.
I am using the following script to automate changing permissions on our file servers using cacls.exe:
Dim oShell, FoldPerm, Calcds, oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
sSysDir = oFSO.GetSpecialFolder(1).Path
If Right(sSysDir,1) <> "\" Then sSysDir = sSysDir & "\"
'Remove all existing permsissions and grant domain admins full rights
Calcds = sSysDir & "cacls.exe"
FoldPerm = """" & Calcds &"""" & """C:\test""" & " /T /C /G " & """-username-""" & ":f"
oShell.Run FoldPerm, 1 , True
If you use the /E switch for cacls the entire script runs without issue. However, I want the first set of alterations to completely overwrite the existing permissions so the /E switch will not be used.
When the /E switch is not used you are prompted, in a separate command window "Are you sure Y/N?" Since this will be running at 2 Am on Sundays I'd prefer to not have to wake up and answer "Yes" every time it hits a new directory.
I'm not very good at this so I'm hoping for some help.