Created
July 31, 2015 06:07
-
-
Save poshcodebear/897c6f0cfc9f7808ccf5 to your computer and use it in GitHub Desktop.
Discovering folders with severed inheritance
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
$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