|
|
@@ -0,0 +1,28 @@
|
|
|
+param(
|
|
|
+ $Path,
|
|
|
+ $Account,
|
|
|
+ [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
|
|
|
+ }
|
|
|
+}
|