Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $path = Read-Host "Enter the path you wish to check"
- [Array] $list = "Path Access Entity Mode Rights"
- [Array] $folders = Get-ChildItem -path $path -recurse | Where {$_.PSIsContainer}
- ForEach ($folder in [Array] $folders)
- {
- [Array] $PSPath += (Convert-Path $folder.pspath)
- }
- #Initialize While Loop, set $p to Array Size - 1
- $i=0
- $p = $PSPath.Count - 1
- While ($i -le $P)
- {
- [Array] $acls += Get-Acl -Path $PSPath[$i] | Format-List
- $i += 1
- }
- #Reset i to 0
- $i=0
- Foreach($acl in $acls)
- {
- ForEach($access in $acl.Access)
- {
- $path = $PSPath[$i]
- ForEach($value in $access.IdentityReference.Value)
- {
- $list += ("$Path $Value")
- } #end ForEach
- } #end ForEach
- $list += ("-------------------------------------- --------------------------------")
- $i+=1
- } #end ForEach
- $list | format-table | Out-File "c:\Users\$env:username\Documents\folderperms.csv"
- Write-Host "File has been saved to c:\Users\$env:username\Documents\folderperms.csv"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement