ICACLS /Q does not suppress success messages in FOR LOOP
hi all,
the title of topics says enough. i've made script reset acls on 2tb drive dynamic links. because icacls /t /l still lookup subfolders of dynamic link, needed make script filter dynamic links. of course needs quiet (/q), because it's 5,000,000 files , folders. isn't quiet. 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 work, it's taking day now.
if execute
icacls "h:/" /setowner administrators /c /q
it's quiet, somehow if it's in loop, not work
for($i=0; $i -le 2; $i=$i+1) {
icacls "h:/" /setowner administrators /c /q
}
i hope can help. appreciate it.
kind regards,
cor
hi,
from test, /q hidding process below:
ps c:\windows\system32> icacls g:\1.txt /setowner administrators /c /q
processed 1 files; failed processing 0 files
ps c:\windows\system32> icacls g:\1.txt /setowner administrators /c
processed file: g:\1.txt
processed 1 files; failed processing 0 files
and tried script. /q, messages regarding "processed files: xxxx" removed in result "successfully xxxx" there.
if have feedback on our support, please send tnfsl@microsoft.com.
Windows Server > File Services and Storage
Comments
Post a Comment