Tobias Simetsreiter преди 2 години
родител
ревизия
c451f2c9a1
променени са 1 файла, в които са добавени 32 реда и са изтрити 0 реда
  1. 32 0
      bin/Add-GroupMigrationACL.ps1

+ 32 - 0
bin/Add-GroupMigrationACL.ps1

@@ -0,0 +1,32 @@
+param(
+    $out="runtime\acl.csv",
+    $base="\\fsch.annax.local\30_Prj"
+)
+
+$ErrorActionPreference = "Stop"
+
+Get-ChildItem $base -Recurse | %{
+    $dir = $_
+    # $dir.FullName | out-host
+    $acl = Get-Acl $dir.FullName
+    # $acl | Out-Host
+    $acl.Access | Where-Object {$_.IsInherited -eq $false} | %{
+        if ($_.IdentityReference.Value -like "ANNAX\*") {
+            $axacl = $_.IdentityReference.Value
+            $wtacl = $null
+            $acl.Access | Where-Object {$_.IsInherited -eq $false -and (($_.IdentityReference.Value -replace "WABTEC\\ANG_") -eq ($axacl -replace "ANNAX\\"))} | %{
+                $wtacl = $_.IdentityReference.Value
+            }
+            if ($null -eq $wtacl) {
+                $dir.FullName | Out-Host
+                $axacl | Out-Host
+                [PSCustomObject]@{
+                    dir=$dir.FullName
+                    acl=$axacl
+                } | Export-Csv -Append $out
+            } else {
+                # "MATCH" | Out-Host
+            }
+        }
+    }
+}