<# .SYNOPSIS This is a simple Powershell script to analyze a given folder structure and look to see what files/folder have uninherited ACL's .DESCRIPTION Find files/folder where admins/owners have been tweaking security permissions. This script accepts 3 parameters. -target The path to the folder to be analyzed. -all If true, analyze files in addition to folders. .EXAMPLE ./FindUnInheritedPerms.ps1 -target c:\temp -all $true ./FindUnInheritedPerms.ps1 -target c:\temp .NOTES .LINK http://www.google.com Author: MotoX80 on Microsoft Q&A Forums #> param ( [string]$target = '', # analyze this folder [boolean]$all = $false ) if ($target -eq '') { "Please specify a target folder to analyze." return } "Base permissions on $target" Get-Acl -Path $target | select-object -ExpandProperty access | format-table -Property IdentityReference, AccessControlType, FileSystemRights, IsInherited if ($all) { $folders = Get-ChildItem -Path $target -recurse } else { $folders = Get-ChildItem -Path $target -Directory -recurse } foreach ($folder in $folders) { $acls = Get-Acl -Path $folder.FullName if ($acls.AreAccessRulesProtected -eq $true) { # we found a folder that does not inherit permissions. $folder.FullName # This one $acls | select-object -ExpandProperty access | format-table -Property IdentityReference, AccessControlType, FileSystemRights, IsInherited } else { # look for additional acls that were added to the ones inherit3ed from parent folder. $unique = $acls | select-object -ExpandProperty access | where-Object -property IsInherited -eq $false if ($unique -ne $null) { "*{0} (In addition to inherited perms)" -f $folder.FullName # This one $unique | format-table -Property IdentityReference, AccessControlType, FileSystemRights, IsInherited } } }