param( $Path, $Account=$env:USERNAME, [Int] $Depth=99 ) foreach ($module in @("NTFSSecurity")){ if (-not (Get-Module -ListAvailable -Name $module)) { Install-Module $module -Scope CurrentUser } if (-not (Get-Module $module)) { Import-Module $module } } Get-ChildItem -Recurse -Depth $Depth -Directory $path | ForEach-Object { $rights = Get-NTFSEffectiveAccess -Account $Account -Path $_.FullName [PSCustomObject]@{ Path=$_.FullName AccessRights=$rights.AccessRights InheritanceFlags=$rights.InheritanceFlags AccessControlType=$rights.AccessControlType InheritedFrom=$rights.InheritedFrom InheritanceEnabled=$rights.InheritanceEnabled Account=$Account Owner=(Get-Acl $_.FullName).Owner } }