Hi all,
The title of this topics says enough. I've made a script to reset the ACLs on a 2TB drive with dynamic links. Because ICACLS /T /L does still lookup all subfolders of a dynamic link, I needed to make a script to filter the dynamic links. Of course it needs to be quiet (/Q), because it's about 5,000,000 files and folders. But it isn't quiet. The script:
function Recurse($path) { write-host $path $fc = new-object -com scripting.filesystemobject $folder = $fc.getfolder($path) foreach ($i in $folder.files) { icacls $i.path /setowner Administrators /c /q icacls $i.path /reset /c /q } foreach ($i in $folder.subfolders) { icacls $i.path /setowner Administrators /c /q icacls $i.path /reset /c /q if ( (get-item $i.path).Attributes.ToString().Contains("ReparsePoint") -eq $false) { Recurse $i.path } } } $path = "H:/" Recurse $path
It seems to work, but it's already taking a day by now.
If I execute
icacls "H:/" /setowner Administrators /c /q
it's quiet, but somehow if it's in the for loop, it does not work
for($i=0; $i -le 2; $i=$i+1) {
ICACLS "H:/" /setowner Administrators /c /q
}
I hope you can help. I would really appreciate it.
Kind regards,
Cor