Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@poshcodebear
Created July 31, 2015 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poshcodebear/897c6f0cfc9f7808ccf5 to your computer and use it in GitHub Desktop.
Save poshcodebear/897c6f0cfc9f7808ccf5 to your computer and use it in GitHub Desktop.
Discovering folders with severed inheritance
$Server = 'server'
$Shares = Get-Content -Path C:\temp\server-shares.txt
$output = foreach ($Share in $Shares) {
$Path = "\\$Server\$Share"
Get-ChildItem -Path $Path -Recurse | `
where attributes -like *directory* | `
Get-Acl | `
Where-Object {$_.AreAccessRulesProtected -eq $True} | `
Select-Object @{Label='Directory';Expression={$_.path.split(':')[-1]}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment