Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Audit ACL on Large File Share

$
0
0

I have to audit the permissions of all folders on a large drive, and I was wondering if the following code is really practical with this many possible folders.

$ntfsreport = @()

 $folders = Get-ChildItem \\serverA\F$ -recurse | where {$_.psIsContainer} 
 foreach ($folder in $folders){
 $acls= (Get-ACL $folder.fullname).Access
 foreach ($acl in $acls){
  $arrshare = [PSCustomObject]@{"Path"=$folder.fullname;"Name"=$acl.identityReference;"Inherited"=$acl.IsInherited}
  $ntfsreport += $arrshare
  }
  }

   $ntfsreport

I am afraid of the memory hit building the $folders and $acls arrays, and not to mention the time it will take. I tried piping everyting down to Foreach-object so the processing can be ongoing, but I kept getting an error that Foreach-Object is not a recognized cmdlet, function, etc. error. I couldn't figure out why so I went with the above code. 

Should I be concerned with memory performance and the runtime for $ntfsreport to finally be available?

TIA

Shane




Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>