Skip to content

Instantly share code, notes, and snippets.

@seriald
Created August 17, 2018 12:09
Show Gist options
  • Save seriald/89ca268c91021b1812e1c0292c864746 to your computer and use it in GitHub Desktop.
Save seriald/89ca268c91021b1812e1c0292c864746 to your computer and use it in GitHub Desktop.
Audit Access Control List given a file path or UNC
$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