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

Popular posts from this blog

some help on Event 540

WMI Repository 4GB limit - Win 2003 Ent Question

Event ID 1302 (error 1307) DFS replication service encountered an error while writing to the debug log file