Skip to content

Instantly share code, notes, and snippets.

@Greyeye
Created June 19, 2014 00:15
Show Gist options
  • Save Greyeye/d6ceee99c04796bdc288 to your computer and use it in GitHub Desktop.
Save Greyeye/d6ceee99c04796bdc288 to your computer and use it in GitHub Desktop.
get custom non inherited permission for a target folder/path
Param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$targetPath
)
$SharedFolders = get-childitem -recurse -path $targetPath |where {$_.Attributes -eq 'Directory'}
foreach($SharedFolder in $SharedFolders)
{
foreach ($access in $sharedFolder.getAccessControl().Access){
if ($access.isinherited -eq $false)
{write-host "Path is " $sharedfolder.fullname -ForegroundColor "red"
$access}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment