Created
August 17, 2018 12:09
-
-
Save seriald/89ca268c91021b1812e1c0292c864746 to your computer and use it in GitHub Desktop.
Audit Access Control List given a file path or UNC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Share = Read-Host -Prompt 'Enter Full Path to Share' #Example: \\servername\share\subfolder | |
Get-childitem $Share -recurse | where{$_.psiscontainer} | | |
Get-Acl | % { | |
$path = $_.Path | |
$_.Access | % { | |
New-Object PSObject -Property @{ | |
Folder = $path.Replace("Microsoft.PowerShell.Core\FileSystem::","") | |
Access = $_.FileSystemRights | |
Control = $_.AccessControlType | |
User = $_.IdentityReference | |
Inheritance = $_.IsInherited | |
} | |
} | |
} | select-object -Property User, Access, Folder | export-csv F:\Data\Scripts\Export\ACL_output.csv -force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment