Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

PS script to output folder ACL's to CSV

By: a guest on Nov 15th, 2012  |  syntax: Power Shell  |  size: 0.96 KB  |  hits: 164  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. $path = Read-Host "Enter the path you wish to check"
  2.  
  3. [Array] $list = "Path   Access Entity   Mode    Rights"
  4. [Array] $folders = Get-ChildItem -path $path -recurse | Where {$_.PSIsContainer}
  5.  
  6. ForEach ($folder in [Array] $folders)
  7. {
  8. [Array] $PSPath += (Convert-Path $folder.pspath)
  9. }
  10.  
  11. #Initialize While Loop, set $p to Array Size - 1
  12. $i=0
  13. $p = $PSPath.Count - 1
  14.  
  15. While ($i -le $P)
  16. {
  17. [Array] $acls += Get-Acl -Path $PSPath[$i] | Format-List
  18. $i += 1
  19. }
  20.  
  21. #Reset i to 0
  22. $i=0
  23.  
  24. Foreach($acl in $acls)
  25. {
  26.         ForEach($access in $acl.Access)
  27.         {
  28.         $path = $PSPath[$i]
  29.                 ForEach($value in $access.IdentityReference.Value)
  30.                 {
  31.                 $list += ("$Path        $Value")
  32.                 } #end ForEach
  33.         } #end ForEach
  34.         $list += ("--------------------------------------       --------------------------------")
  35. $i+=1  
  36. } #end ForEach
  37. $list | format-table | Out-File "c:\Users\$env:username\Documents\folderperms.csv"
  38.  
  39. Write-Host "File has been saved to c:\Users\$env:username\Documents\folderperms.csv"