From 9e18f320cd395d2f376476d45a4549eee887e81a Mon Sep 17 00:00:00 2001 From: Edmond Gebara Date: Mon, 6 Jul 2026 22:19:54 +0200 Subject: [PATCH] changed: verboseoutlog to outlog (reducing runtime) --- CLAUDE.md | 6 +- Process-ADObjects-Analyze.ps1 | 42 ++-- Process-ADObjects-Base.ps1 | 34 +-- Process-ADObjects-Test.ps1 | 4 +- Process-ADObjects-Utility.ps1 | 9 +- Process-ADObjects-Work-R125.ps1 | 374 ++++++++++++++++---------------- Process-ADObjects-Work-Y015.ps1 | 362 +++++++++++++++---------------- Process-ADObjects-Work.ps1 | 40 ++-- Process-ADObjects.ps1 | 0 9 files changed, 434 insertions(+), 437 deletions(-) mode change 100755 => 100644 Process-ADObjects.ps1 diff --git a/CLAUDE.md b/CLAUDE.md index 0ad2edd..27c78d4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -17,7 +17,7 @@ per institute (down from 10 h; do not regress this). | `Process-ADObjects.ps1` | Main entry, loads config, dot-sources the rest | | `Process-ADObjects-Configuration.ps1` | `$Config` hashtable: institutes, GroupManagementMappings, flags (`TestMode`, `Verbose`, ...). Pure data, no logic | | `Process-ADObjects-Base.ps1` | Core lookups: membership index (`newObjectMembershipsIndex`, `getObjectMemberships`, `getUsersByMemberGroup`), `getRoleType`, prefix matcher (`buildPrefixMatcher`, `testKnownPrefixes`) | -| `Process-ADObjects-Utility.ps1` | Logging (`openLog`/`closeLog`/`outLog`/`outLogVerbose`), input checks, exception helpers, `removeDuplicatesFromSortedList` | +| `Process-ADObjects-Utility.ps1` | Logging (`openLog`/`closeLog`/`outLog`/`### outLogVerbose`), input checks, exception helpers, `removeDuplicatesFromSortedList` | | `Process-ADObjects-Work.ps1` | Institute dispatch | | `Process-ADObjects-Work-R125.ps1` / `-Y015.ps1` | Per-institute processing. Structurally identical copies (deduplication planned). Sections: FileSystemAccess, AppAccess, AppConfiguration, Organisation, Security, Anwenderrollen; then post-processing (sort → dedup → Neu derivation → file writes) | | `Process-ADObjects-Analyze.ps1` | AD object analysis. Known incomplete; cleanup planned | @@ -28,7 +28,7 @@ per institute (down from 10 h; do not regress this). - **English** for all code, comments, identifiers, log messages. German only in chat. - **Allman** brace style (opening brace on its own line). - **`utf8NoBom`** for every file output; LF is fine (runs on macOS/pwsh 7). -- No `Write-Host` in processing code — use `outLog` / `outLogVerbose`. +- No `Write-Host` in processing code — use `outLog` / `### outLogVerbose`. Exceptions: the output helpers themselves (`outLog`, `outScreen`, `dumpVar`, `writeExceptionInfo*`). - Institute code is parameterized via `$SPKID` (e.g. "R125") and `$SPKNO` @@ -44,7 +44,7 @@ per institute (down from 10 h; do not regress this). - `outLog ... -ToScreen $false` — file only. Named parameter only; positional args all go to the message (`PositionalBinding=$false` + `ValueFromRemainingArguments`). -- `outLogVerbose ` — trace layer, gated by `$Config.Verbose`, never to +- `### outLogVerbose ` — trace layer, gated by `$Config.Verbose`, never to screen. ~440 call sites instrument every loop iteration and if/elseif/else branch. With `Verbose = $true` a full run writes millions of lines — use `TestMode` for verbose runs. diff --git a/Process-ADObjects-Analyze.ps1 b/Process-ADObjects-Analyze.ps1 index bac665d..ef5b777 100644 --- a/Process-ADObjects-Analyze.ps1 +++ b/Process-ADObjects-Analyze.ps1 @@ -1,7 +1,7 @@ function analyzeADObjects { - Param + param ( [Parameter(Mandatory = $false, Position = 0)] [bool] $startParallel = $false @@ -18,7 +18,7 @@ function analyzeADObjects if ($startParallel) { - outLogVerbose 'if ($startParallel) -> true' + ### outLogVerbose 'if ($startParallel) -> true' Start-ThreadJob -ScriptBlock { $adObjectsOrganisation += analyzeADObjectsByType $FI.TypeTagOrganisation} Start-ThreadJob -ScriptBlock { $adObjectsAppAccess += analyzeADObjectsByType $FI.TypeTagAppAccess} Start-ThreadJob -ScriptBlock { $adObjectsFilesystemAccess += analyzeADObjectsByType $FI.TypeTagFilesystemAccess} @@ -28,7 +28,7 @@ function analyzeADObjects } else { - outLogVerbose 'else -> true (if/elseif ($startParallel) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($startParallel) -> false)' $adObjectsOrganisation += analyzeADObjectsByType $FI.TypeTagOrganisation $adObjectsAppAccess += analyzeADObjectsByType $FI.TypeTagAppAccess $adObjectsFilesystemAccess += analyzeADObjectsByType $FI.TypeTagFilesystemAccess @@ -63,7 +63,7 @@ function analyzeDirectoryPaths function analyzeADObjectsByType { - Param + param ( [Parameter(Mandatory = $true, Position = 0)] [String] $typeTag @@ -77,92 +77,92 @@ function analyzeADObjectsByType foreach ($adObject in $ADObjects) { outLogVerbose 'foreach $adObject in $ADObjects:' $adObject.ObjectName - if (-Not ($adObject.Description)) + if (-not ($adObject.Description)) { - outLogVerbose 'if (-Not ($adObject.Description)) -> true' + ### outLogVerbose 'if (-Not ($adObject.Description)) -> true' $adObject.Description = $Config.EmptyDescription } if ($typeTag -ieq $FI.TypeTagAppConfiguration) { - outLogVerbose 'if ($typeTag -ieq $FI.TypeTagAppConfiguration) -> true' + ### outLogVerbose 'if ($typeTag -ieq $FI.TypeTagAppConfiguration) -> true' if ($adObject.OU -cmatch $FI.RelevantGroups.AppConfiguration.Filter) { - outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.AppConfiguration.Filter) -> true' + ### outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.AppConfiguration.Filter) -> true' $userMemberShips = getAllUserMemberships $adObject $adObjectEntry = @{ObjectName = $adObject.ObjectName; Path = $adObject.OU; ShortCut = $FI.RelevantGroups.AppConfiguration.ShortCut; Description = $adObject.Description; Users = $userMemberShips} $adGroupObjects += $adObjectEntry $counter++ if ($IsTestMode -and ($counter -gt $Config.TestMode) ) { - outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' + ### outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' break } } } elseif ($typeTag -ieq $FI.TypeTagAppAccess) { - outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagAppAccess) -> true' + ### outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagAppAccess) -> true' if ($adObject.OU -cmatch $FI.RelevantGroups.AppAccess.Filter) { - outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.AppAccess.Filter) -> true' + ### outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.AppAccess.Filter) -> true' $userMemberShips = getAllUserMemberships $adObject $adObjectEntry = @{ObjectName = $adObject.ObjectName; Path = $adObject.OU; ShortCut = $FI.RelevantGroups.AppAccess.ShortCut; Description = $adObject.Description; Users = $userMemberShips} $adGroupObjects += $adObjectEntry $counter++ if ($IsTestMode -and ($counter -gt $Config.TestMode) ) { - outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' + ### outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' break } } } elseif ($typeTag -ieq $FI.TypeTagFileSystemAccess) { - outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagFileSystemAccess) -> true' + ### outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagFileSystemAccess) -> true' if ($adObject.OU -cmatch $FI.RelevantGroups.FilesystemAccess.Filter) { - outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.FilesystemAccess.Filter) -> true' + ### outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.FilesystemAccess.Filter) -> true' $userMemberShips = getAllUserMemberships $adObject $adObjectEntry = @{ObjectName = $adObject.ObjectName; Path = $adObject.OU; ShortCut = $FI.RelevantGroups.FilesystemAccess.ShortCut; Description = $adObject.Description; Users = $userMemberShips} $adGroupObjects += $adObjectEntry $counter++ if ($IsTestMode -and ($counter -gt $Config.TestMode) ) { - outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' + ### outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' break } } } elseif ($typeTag -ieq $FI.TypeTagOrganisation) { - outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagOrganisation) -> true' + ### outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagOrganisation) -> true' if ($adObject.OU -cmatch $FI.RelevantGroups.Organisation.Filter) { - outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.Organisation.Filter) -> true' + ### outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.Organisation.Filter) -> true' $userMemberShips = getAllUserMemberships $adObject $adObjectEntry = @{ObjectName = $adObject.ObjectName; Path = $adObject.OU; ShortCut = $FI.RelevantGroups.Organisation.ShortCut; Description = $adObject.Description; Users = $userMemberShips} $adGroupObjects += $adObjectEntry $counter++ if ($IsTestMode -and ($counter -gt $Config.TestMode) ) { - outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' + ### outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' break } } } elseif ($typeTag -ieq $FI.TypeTagSecurity) { - outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagSecurity) -> true' + ### outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagSecurity) -> true' if ($adObject.OU -cmatch $FI.RelevantGroups.Security.Filter) { - outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.Security.Filter) -> true' + ### outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.Security.Filter) -> true' $userMemberShips = getAllUserMemberships $adObject $adObjectEntry = @{ObjectName = $adObject.ObjectName; Path = $adObject.OU; ShortCut = $FI.RelevantGroups.Security.ShortCut; Description = $adObject.Description; Users = $userMemberShips} $adGroupObjects += $adObjectEntry $counter++ if ($IsTestMode -and ($counter -gt $Config.TestMode) ) { - outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' + ### outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' break } } diff --git a/Process-ADObjects-Base.ps1 b/Process-ADObjects-Base.ps1 index cb0d958..5fdb6f5 100644 --- a/Process-ADObjects-Base.ps1 +++ b/Process-ADObjects-Base.ps1 @@ -37,7 +37,7 @@ function getObjectMemberships } else { - outLogVerbose 'else -> true (if/elseif (?) -> false)' + ### outLogVerbose 'else -> true (if/elseif (?) -> false)' @($bucket) } @@ -60,7 +60,7 @@ function getAllUserMemberships $groupMemberships = @(getObjectMemberships $adObjectEntry.ObjectName "group" "group") foreach ($groupMembership in $groupMemberships) { - outLogVerbose 'foreach $groupMembership in $groupMemberships:' $groupMembership.MemberName + ### outLogVerbose 'foreach $groupMembership in $groupMemberships:' $groupMembership.MemberName $result.AddRange(@(getObjectMemberships $groupMembership.MemberName "user" "group")) } return @($result) @@ -81,7 +81,7 @@ function getUsersByMemberGroup } else { - outLogVerbose 'else -> true (if/elseif (?) -> false)' + ### outLogVerbose 'else -> true (if/elseif (?) -> false)' @($bucket) } return $result @@ -118,18 +118,18 @@ function newObjectMembershipsIndex foreach ($entry in $ADObjectMemberships) { - outLogVerbose 'foreach $entry in $ADObjectMemberships:' $entry.GroupName + ### outLogVerbose 'foreach $entry in $ADObjectMemberships:' $entry.GroupName $key = getMembershipIndexKey $($entry.GroupName) $($entry.MemberClass) $key0 = "$($entry.GroupName)`0$($entry.MemberClass)".ToLowerInvariant() if (-not($key -eq $key0)) { - outLogVerbose 'if (-not($key -eq $key0)) -> true' + ### outLogVerbose 'if (-not($key -eq $key0)) -> true' throw "this is BAAAD" } $bucket = $index[$key] if ($null -eq $bucket) { - outLogVerbose 'if ($null -eq $bucket) -> true' + ### outLogVerbose 'if ($null -eq $bucket) -> true' $bucket = [System.Collections.Generic.List[object]]::new() $index[$key] = $bucket } @@ -152,17 +152,17 @@ function getRoleType $relevantRoleTypes = $SPK.GroupManagementMappings | Where-Object {$_.OU -ieq $typeTag} | Sort-Object { [int]$_.Order } foreach ($relevantRoleType in $relevantRoleTypes) { - outLogVerbose 'foreach $relevantRoleType in $relevantRoleTypes:' $relevantRoleType.TypeName + ### outLogVerbose 'foreach $relevantRoleType in $relevantRoleTypes:' $relevantRoleType.TypeName if ($adObjectEntry.OldName -cmatch $relevantRoleType.TagRegExp) { - outLogVerbose 'if ($adObjectEntry.OldName -cmatch $relevantRoleType.TagRegExp) -> true' + ### outLogVerbose 'if ($adObjectEntry.OldName -cmatch $relevantRoleType.TagRegExp) -> true' $roleType = $relevantRoleType.TypeName break } } if (($typeTag -ieq $FI.TypeTagSecurity) -and ($roleType -ieq "unknown")) { - outLogVerbose 'if (($typeTag -ieq $FI.TypeTagSecurity) -and ($roleType -ieq "unknown")) -> true' + ### outLogVerbose 'if (($typeTag -ieq $FI.TypeTagSecurity) -and ($roleType -ieq "unknown")) -> true' $roleType = "GPO" } return $roletype @@ -177,7 +177,7 @@ function buildPrefixMatcher if (-not (Test-Path $CsvPath)) { - outLogVerbose 'if (-not (Test-Path $CsvPath)) -> true' + ### outLogVerbose 'if (-not (Test-Path $CsvPath)) -> true' throw "Prefix CSV not found: $CsvPath" } @@ -185,11 +185,11 @@ function buildPrefixMatcher foreach ($row in $SPK.ProfilPrefixes) { - outLogVerbose 'foreach $row in $SPK.ProfilPrefixes:' $row + ### outLogVerbose 'foreach $row in $SPK.ProfilPrefixes:' $row $prefix = $row.Prefix if ([string]::IsNullOrEmpty($prefix)) { - outLogVerbose 'if ([string]::IsNullOrEmpty($prefix)) -> true' + ### outLogVerbose 'if ([string]::IsNullOrEmpty($prefix)) -> true' continue } @@ -197,7 +197,7 @@ function buildPrefixMatcher $bucket = $null if (-not $byLength.TryGetValue($len, [ref] $bucket)) { - outLogVerbose 'if (-not $byLength.TryGetValue($len, [ref] $bucket)) -> true' + ### outLogVerbose 'if (-not $byLength.TryGetValue($len, [ref] $bucket)) -> true' $bucket = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::Ordinal) $byLength[$len] = $bucket } @@ -223,24 +223,24 @@ function testKnownPrefixes if ([string]::IsNullOrEmpty($Value)) { - outLogVerbose 'if ([string]::IsNullOrEmpty($Value)) -> true' + ### outLogVerbose 'if ([string]::IsNullOrEmpty($Value)) -> true' return $false } $valueLen = $Value.Length foreach ($len in $Matcher.Lengths) { - outLogVerbose 'foreach $len in $Matcher.Lengths:' $len + ### outLogVerbose 'foreach $len in $Matcher.Lengths:' $len if ($len -gt $valueLen) { - outLogVerbose 'if ($len -gt $valueLen) -> true' + ### outLogVerbose 'if ($len -gt $valueLen) -> true' continue } $candidate = $Value.Substring(0, $len) $bucket = $Matcher.ByLength[$len] if ($bucket.Contains($candidate)) { - outLogVerbose 'if ($bucket.Contains($candidate)) -> true' + ### outLogVerbose 'if ($bucket.Contains($candidate)) -> true' return $true } } diff --git a/Process-ADObjects-Test.ps1 b/Process-ADObjects-Test.ps1 index 8dd7407..3940ddc 100644 --- a/Process-ADObjects-Test.ps1 +++ b/Process-ADObjects-Test.ps1 @@ -14,9 +14,9 @@ function TestExcel { $colCount = $workSheet.UsedRange.LastColumn for ($i = 2; $i -le $rowCount; $i++) { - outLogVerbose 'for ($i = 2; $i -le $rowCount; $i++) iteration:' $i + outLog ('for ($i = 2; $i -le $rowCount; $i++) iteration: ' + $i) for ($j = 1; $j -le $colCount; $j++) { - outLogVerbose 'for ($j = 1; $j -le $colCount; $j++) iteration:' $j + ### outLogVerbose 'for ($j = 1; $j -le $colCount; $j++) iteration:' $j $value = $workSheet.Range[$i, $j].DisplayText $newValue = $value -replace "`n", " --- " -replace "`r", " --- " -replace ";", "--" -replace "`"", "'" $workSheet.Range[$i, $j].Text = $newValue diff --git a/Process-ADObjects-Utility.ps1 b/Process-ADObjects-Utility.ps1 index 06b4f60..3b66bc5 100644 --- a/Process-ADObjects-Utility.ps1 +++ b/Process-ADObjects-Utility.ps1 @@ -1,4 +1,3 @@ - function convertUTF8ToASCII { param ([Parameter(Mandatory = $true, Position = 0)] [String]$utf8Text) @@ -89,6 +88,7 @@ function removeDuplicatesFromSortedList param ( [Parameter(Mandatory = $true)] + [AllowEmptyCollection()] [System.Collections.Generic.List[string]] $List, [Parameter(Mandatory = $false)] [string] $ListName = "list" @@ -344,13 +344,6 @@ function moveToInstituteTmpPath return $tmpFilePath } -function convertUTF8ToASCII -{ - param ([Parameter(Mandatory = $true, Position = 0)][string]$text) - $utf8Text = [system.text.encoding]::UTF8.GetBytes($text) - $asciiText = [system.text.encoding]::convert([text.encoding]::UTF8, [text.encoding]::ASCII, $utf8Text) - -join [system.text.encoding]::ASCII.GetChars($asciiText) -} function writeExceptionInfoReduced diff --git a/Process-ADObjects-Work-R125.ps1 b/Process-ADObjects-Work-R125.ps1 index cb26e63..3876afc 100644 --- a/Process-ADObjects-Work-R125.ps1 +++ b/Process-ADObjects-Work-R125.ps1 @@ -27,10 +27,10 @@ function ProcessADObjects $mitarbeiterStelle_array = @{ "mitarbeiter" = "stelle" } foreach ($item in $MitarbeiterEntries) { - outLogVerbose 'foreach $item in $MitarbeiterEntries:' $item.'St.-Nr.' + outLog ('foreach $item in $MitarbeiterEntries: ' + $item.'St.-Nr.') if ([System.String]::IsNullOrEmpty($item.Benutzerkennung)) { - outLogVerbose 'if ([System.String]::IsNullOrEmpty($item.Benutzerkennung)) -> true' + ### outLogVerbose 'if ([System.String]::IsNullOrEmpty($item.Benutzerkennung)) -> true' continue } try @@ -52,7 +52,7 @@ function ProcessADObjects if ($roletypeTag -ieq $FI.TypeTagFilesystemAccess) { - outLogVerbose 'if ($roletypeTag -ieq $FI.TypeTagFilesystemAccess) -> true' + ### outLogVerbose 'if ($roletypeTag -ieq $FI.TypeTagFilesystemAccess) -> true' try { @@ -64,10 +64,10 @@ function ProcessADObjects foreach ($item in $AnwendungenFilePathEntries) { - outLogVerbose 'foreach $item in $AnwendungenFilePathEntries:' $item.Verzeichnisname + outLog ('[$roletypeTag -ieq $FI.TypeTagFilesystemAccess] foreach $item in $AnwendungenFilePathEntries: ' + $item.Verzeichnisname) if ([System.String]::IsNullOrEmpty($item.Verzeichnisname)) { - outLogVerbose 'if ([System.String]::IsNullOrEmpty($item.Verzeichnisname)) -> true' + ### outLogVerbose 'if ([System.String]::IsNullOrEmpty($item.Verzeichnisname)) -> true' continue } try @@ -98,7 +98,7 @@ function ProcessADObjects foreach ($item in $DirectoriesFilePathEntries) { - outLogVerbose 'foreach $item in $DirectoriesFilePathEntries:' $item.Verzeichnisname + outLog ('[$roletypeTag -ieq $FI.TypeTagFilesystemAccess] foreach $item in $DirectoriesFilePathEntries: ' + $item.Verzeichnisname) try { @@ -166,11 +166,11 @@ function ProcessADObjects foreach ($item in $FileSystemAccessEntries) { - outLogVerbose 'foreach $item in $FileSystemAccessEntries:' $item.Name + outLog ('[$roletypeTag -ieq $FI.TypeTagFilesystemAccess] foreach $item in $FileSystemAccessEntries: ' + $item.Name) if ( $item.Name.Contains("GGF-VDA-")) { - outLogVerbose 'if ($item.Name.Contains("GGF-VDA-")) -> true' + ### outLogVerbose 'if ($item.Name.Contains("GGF-VDA-")) -> true' continue } @@ -182,17 +182,17 @@ function ProcessADObjects $EndString = "" if ( $item.Name.EndsWith("_L")) { - outLogVerbose 'if ($item.Name.EndsWith("_L")) -> true' + ### outLogVerbose 'if ($item.Name.EndsWith("_L")) -> true' $EndString = "_L" } elseif ($item.Name.EndsWith("_A")) { - outLogVerbose 'elseif ($item.Name.EndsWith("_A")) -> true' + ### outLogVerbose 'elseif ($item.Name.EndsWith("_A")) -> true' $EndString = "_A" } else { - outLogVerbose 'else -> true (if/elseif ($item.Name.EndsWith("_A")) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($item.Name.EndsWith("_A")) -> false)' $EndString = "_X" } @@ -206,43 +206,43 @@ function ProcessADObjects if ($art_array.Item($item.Name) -ieq "FAC123") { - outLogVerbose 'if ($art_array.Item($item.Name) -ieq "FAC123") -> true' + ### outLogVerbose 'if ($art_array.Item($item.Name) -ieq "FAC123") -> true' $V = "FAC_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "AUS123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "AUS123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "AUS123") -> true' $V = "AUS_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "PKU123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "PKU123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "PKU123") -> true' $V = "PKU_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "SON123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "SON123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "SON123") -> true' $V = "SON_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "UBE123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "UBE123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "UBE123") -> true' $V = "UBE_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "UNT123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "UNT123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "UNT123") -> true' $V = "UNT_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "VAW123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "VAW123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "VAW123") -> true' $V = "VAW_" $AWNRNEW = "9997" @@ -253,7 +253,7 @@ function ProcessADObjects $AWNRNEW = $dnummer_array.Item($item.Name).PadLeft(4, '0') if (-not $AWNRNEW) { - outLogVerbose 'if (-not $AWNRNEW) -> true' + ### outLogVerbose 'if (-not $AWNRNEW) -> true' $AWNRNEW = "9997" } } @@ -268,7 +268,7 @@ function ProcessADObjects if (-not $DKZ) { - outLogVerbose 'if (-not $DKZ) -> true' + ### outLogVerbose 'if (-not $DKZ) -> true' $DKZ = "XXXXX" } } @@ -284,26 +284,26 @@ function ProcessADObjects if ( $art_array.Contains($item.Name)) { - outLogVerbose 'if ($art_array.Contains($item.Name)) -> true' + ### outLogVerbose 'if ($art_array.Contains($item.Name)) -> true' if ($art_array.Item($item.Name) -ieq "Programm-Ablage") { - outLogVerbose 'if ($art_array.Item($item.Name) -ieq "Programm-Ablage") -> true' + ### outLogVerbose 'if ($art_array.Item($item.Name) -ieq "Programm-Ablage") -> true' $NewShortName = $V } elseif ($art_array.Item($item.Name) -ieq "VAW") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "VAW") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "VAW") -> true' $NewShortName = $V } elseif ($art_array.Item($item.Name) -ieq "PRG") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "PRG") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "PRG") -> true' try { $AWNRNEW = $dnummer_array.Item($item.Name).PadLeft(4, '0') if (-not $AWNRNEW) { - outLogVerbose 'if (-not $AWNRNEW) -> true' + ### outLogVerbose 'if (-not $AWNRNEW) -> true' $AWNRNEW = "9998" } } @@ -317,22 +317,22 @@ function ProcessADObjects } else { - outLogVerbose 'else -> true (if/elseif ($art_array.Item($item.Name) -ieq "PRG") -> false)' + ### outLogVerbose 'else -> true (if/elseif ($art_array.Item($item.Name) -ieq "PRG") -> false)' $NewShortName = $V + $path_array.Item($item.Name) + $EndString } } else { - outLogVerbose 'else -> true (if/elseif ($art_array.Contains($item.Name)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($art_array.Contains($item.Name)) -> false)' $test = $item.Name.Substring(0, $item.Name.Length - 2) if ( $key_array.ContainsKey($test)) { - outLogVerbose 'if ($key_array.ContainsKey($test)) -> true' + ### outLogVerbose 'if ($key_array.ContainsKey($test)) -> true' } else { - outLogVerbose 'else -> true (if/elseif ($key_array.ContainsKey($test)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($key_array.ContainsKey($test)) -> false)' $cntNichtGelistet++ $key_array.Add($test, $cntNichtGelistet) } @@ -346,7 +346,7 @@ function ProcessADObjects if ( $Description.Contains("## keine Beschreibung ##")) { - outLogVerbose 'if ($Description.Contains("## keine Beschreibung ##")) -> true' + ### outLogVerbose 'if ($Description.Contains("## keine Beschreibung ##")) -> true' $VA = $verantwortlicher_array.Item($item.Name) $Description = $Description + " Verantwortlicher: " + $VA } @@ -371,16 +371,16 @@ function ProcessADObjects foreach ($item in $FileSystemAccessEntriesNew) { - outLogVerbose 'foreach $item in $FileSystemAccessEntriesNew:' $item.OldName + outLog ('[$roletypeTag -ieq $FI.TypeTagFilesystemAccess] foreach $item in $FileSystemAccessEntriesNew: ' + $item.OldName) $roleType = "unknown" $relevantRoleTypes = $SPK.GroupManagementMappings | Where-Object { $_.OU -ieq $FI.TypeTagFilesystemAccess } | Sort-Object { [int]$_.Order } foreach ($relevantRoleType in $relevantRoleTypes) { - outLogVerbose 'foreach $relevantRoleType in $relevantRoleTypes:' $relevantRoleType.TypeName + ### outLogVerbose 'foreach $relevantRoleType in $relevantRoleTypes:' $relevantRoleType.TypeName if ($item.OldName -cmatch $relevantRoleType.TagRegExp) { - outLogVerbose 'if ($item.OldName -cmatch $relevantRoleType.TagRegExp) -> true' + ### outLogVerbose 'if ($item.OldName -cmatch $relevantRoleType.TagRegExp) -> true' $roleType = $relevantRoleType.TypeName break } @@ -401,7 +401,7 @@ function ProcessADObjects if (-not $DKZ) { - outLogVerbose 'if (-not $DKZ) -> true' + ### outLogVerbose 'if (-not $DKZ) -> true' $MYANR = "9997" } } @@ -422,7 +422,7 @@ function ProcessADObjects $AWNRNEW = $dnummer_array.Item($item.OldName).PadLeft(4, '0') if (-not $AWNRNEW) { - outLogVerbose 'if (-not $AWNRNEW) -> true' + ### outLogVerbose 'if (-not $AWNRNEW) -> true' $AWNRNEW = "9998" } @@ -435,182 +435,182 @@ function ProcessADObjects if ($VerzeichnisArt -ieq "SKL") { - outLogVerbose 'if ($VerzeichnisArt -ieq "SKL") -> true' + ### outLogVerbose 'if ($VerzeichnisArt -ieq "SKL") -> true' $ProfilNummer = "42" + ([string]$CntSKL).PadLeft(7, '0') $CntSKL++ $ProfilName = "SKL " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf SKL aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf SKL lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "SON") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "SON") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "SON") -> true' $ProfilNummer = "42" + ([string]$CntSON).PadLeft(7, '0') $CntSON++ $ProfilName = "SON " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf SON aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf SON lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "AKT") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "AKT") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "AKT") -> true' $ProfilNummer = "42" + ([string]$CntAKT).PadLeft(7, '0') $CntAKT++ $ProfilName = "AKT " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf AKT aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf AKT lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "MSV") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "MSV") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "MSV") -> true' $ProfilNummer = "42" + ([string]$CntMSV).PadLeft(7, '0') $CntMSV++ $ProfilName = "MSV " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf MSV aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf MSV lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "PRO") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "PRO") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "PRO") -> true' $ProfilNummer = "42" + ([string]$CntPRO).PadLeft(7, '0') $CntPRO++ $ProfilName = "PRO " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf PRO aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf PRO lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "SPK") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "SPK") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "SPK") -> true' $ProfilNummer = "42" + ([string]$CntSPK).PadLeft(7, '0') $CntSPK++ $ProfilName = "SPK " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf SPK aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf SPK lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "VRZ") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "VRZ") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "VRZ") -> true' $ProfilNummer = "42" + ([string]$CntVRZ).PadLeft(7, '0') $CntVRZ++ $ProfilName = "VRZ " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf VRZ aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf VRZ lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "VOE") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "VOE") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "VOE") -> true' $ProfilNummer = "42" + ([string]$CntVOE).PadLeft(7, '0') $CntVOE++ $ProfilName = "VOE " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf VOE aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf VOE lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "PRG") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "PRG") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "PRG") -> true' if ($AWNRNEW -ieq "9997") { - outLogVerbose 'if ($AWNRNEW -ieq "9997") -> true' + ### outLogVerbose 'if ($AWNRNEW -ieq "9997") -> true' $ProfilNummer = "42" + ([string]$CntPRG).PadLeft(7, '0') $CntPRG++ } elseif ($AWNRNEW -ieq "0000") { - outLogVerbose 'elseif ($AWNRNEW -ieq "0000") -> true' + ### outLogVerbose 'elseif ($AWNRNEW -ieq "0000") -> true' $ProfilNummer = "42" + ([string]$CntPRG).PadLeft(7, '0') $CntPRG++ } else { - outLogVerbose 'else -> true (if/elseif ($AWNRNEW -ieq "0000") -> false)' + ### outLogVerbose 'else -> true (if/elseif ($AWNRNEW -ieq "0000") -> false)' if ( $rbkey_array.ContainsKey("PAN_" + $AWNRNEW)) { - outLogVerbose 'if ($rbkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> true' + ### outLogVerbose 'if ($rbkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> true' $rbkey_array.Item("PAN_" + $AWNRNEW)++ } else { - outLogVerbose 'else -> true (if/elseif ($rbkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($rbkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> false)' $rbkey_array.Add("PAN_" + $AWNRNEW, 200) } @@ -622,69 +622,69 @@ function ProcessADObjects $ProfilName = "SIA " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf SIA aendern " + $NewFullName.Replace($SPKID + "GGX-", "") } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf SIA lesen " + $NewFullName.Replace($SPKID + "GGX-", "") } } elseif ($VerzeichnisArt -ieq "PRG12") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "PRG12") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "PRG12") -> true' $ProfilNummer = "42" + ([string]$CntPRG).PadLeft(7, '0') $CntPRG++ $ProfilName = "PROG " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf PRG aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf PRG lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "VRZ") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "VRZ") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "VRZ") -> true' $ProfilNummer = "42" + ([string]$CntVRZ).PadLeft(7, '0') $CntVRZ++ $ProfilName = "VRZ " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf VRZ aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf VRZ lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "SPK") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "SPK") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "SPK") -> true' $ProfilNummer = "42" + ([string]$CntSPK).PadLeft(7, '0') $CntSPK++ $ProfilName = "SPK " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf SPK aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf SPK lesen " + $NewFullName } @@ -692,19 +692,19 @@ function ProcessADObjects elseif ($VerzeichnisArt -ieq "PROG1") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "PROG1") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "PROG1") -> true' $ProfilNummer = $CntProgramm $CntProgramm++ $ProfilName = "Anwendungsverzeichnis " + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf Programm aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf Programm lesen " + $NewFullName } @@ -716,7 +716,7 @@ function ProcessADObjects $AWNRNEW = $dnummer_array.Item($item.OldName).PadLeft(4, '0') if (-not $AWNRNEW) { - outLogVerbose 'if (-not $AWNRNEW) -> true' + ### outLogVerbose 'if (-not $AWNRNEW) -> true' $AWNRNEW = "9997" } @@ -731,7 +731,7 @@ function ProcessADObjects if (-not $DKZ) { - outLogVerbose 'if (-not $DKZ) -> true' + ### outLogVerbose 'if (-not $DKZ) -> true' $DKZ = "XXXXX" } @@ -745,12 +745,12 @@ function ProcessADObjects if ( $pkey_array.ContainsKey("PAN_" + $AWNRNEW)) { - outLogVerbose 'if ($pkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> true' + ### outLogVerbose 'if ($pkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> true' $pkey_array.Item("PAN_" + $AWNRNEW)++ } else { - outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> false)' $pkey_array.Add("PAN_" + $AWNRNEW, 1) } @@ -758,15 +758,15 @@ function ProcessADObjects } elseif ($VerzeichnisArt -ieq "AW") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "AW") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "AW") -> true' if ( $avkey_array.ContainsKey("AV_" + $MYANR)) { - outLogVerbose 'if ($avkey_array.ContainsKey("AV_" + $MYANR)) -> true' + ### outLogVerbose 'if ($avkey_array.ContainsKey("AV_" + $MYANR)) -> true' $avkey_array.Item("AV_" + $MYANR)++ } else { - outLogVerbose 'else -> true (if/elseif ($avkey_array.ContainsKey("AV_" + $MYANR)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($avkey_array.ContainsKey("AV_" + $MYANR)) -> false)' $avkey_array.Add("AV_" + $MYANR, 1) } @@ -777,19 +777,19 @@ function ProcessADObjects $ProfilName = "AW_" + $NewFullName if ( $NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf Anwendungsverzeichnisse aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf Anwendungsverzeichnisse lesen " + $NewFullName } } else { - outLogVerbose 'else -> true (if/elseif ($VerzeichnisArt -ieq "AW") -> false)' + ### outLogVerbose 'else -> true (if/elseif ($VerzeichnisArt -ieq "AW") -> false)' try { $ProfilNummer = "97000" + ([string]$CntElse).PadLeft(4, '0') @@ -806,16 +806,16 @@ function ProcessADObjects $dum = $verantwortlicher_array.Item($item.OldName) if ($dum) { - outLogVerbose 'if ($dum) -> true' + ### outLogVerbose 'if ($dum) -> true' if ( $dum.StartsWith("S" + $SPKNO)) { - outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' + ### outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' $dum = $mitarbeiterStelle_array.Item($verantwortlicher_array.Item($item.OldName)) } } else { - outLogVerbose 'else -> true (if/elseif ($dum) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($dum) -> false)' $dum = "0570000/0012" } @@ -828,13 +828,13 @@ function ProcessADObjects foreach ($item1 in $ADObjectMemberships) { - outLogVerbose 'foreach $item1 in $ADObjectMemberships:' $item1.GroupName + ### outLogVerbose 'foreach $item1 in $ADObjectMemberships:' $item1.GroupName if ($item1.GroupName -ieq $item.OldName) { - outLogVerbose 'if ($item1.GroupName -ieq $item.OldName) -> true' + ### outLogVerbose 'if ($item1.GroupName -ieq $item.OldName) -> true' if ($item1.MemberClass -ieq "user") { - outLogVerbose 'if ($item1.MemberClass -ieq "user") -> true' + ### outLogVerbose 'if ($item1.MemberClass -ieq "user") -> true' $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $item1.MemberName + ";" + "" + ";" + "" + ";" + "user" + ";" + "" $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) @@ -842,7 +842,7 @@ function ProcessADObjects $dum = $mitarbeiter_array.Item($item1.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $item1.MemberName } $KURSIstMitarbeiterProfileOutLine = $dum + ";" + $item.OldName + ";" + ($ProfilNummer).ToString() + ";" + "FileSystemAccess" @@ -850,12 +850,12 @@ function ProcessADObjects } elseif ($item1.MemberClass -ieq "group") { - outLogVerbose 'elseif ($item1.MemberClass -ieq "group") -> true' + ### outLogVerbose 'elseif ($item1.MemberClass -ieq "group") -> true' $users = getUsersByMemberGroup $item1.MemberName foreach ($u in $users) { - outLogVerbose 'foreach $u in $users:' $u.MemberName + ### outLogVerbose 'foreach $u in $users:' $u.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $u.MemberName + ";" + "" + ";" + "" + ";" + "group" + ";" + $item1.MemberName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) } @@ -875,7 +875,7 @@ function ProcessADObjects elseif ($roletypeTag -ieq $FI.TypeTagAppAccess) { - outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagAppAccess) -> true' + ### outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagAppAccess) -> true' try { @@ -893,21 +893,21 @@ function ProcessADObjects foreach ($item in $AnwendungenFilePathEntries) { - outLogVerbose 'foreach $item in $AnwendungenFilePathEntries:' $item.'Nr.' + outLog ('[$roletypeTag -ieq $FI.TypeTagAppAccess] foreach $item in $AnwendungenFilePathEntries: ' + $item.'Nr.') $Verantwortlicher = $item.'Verantwortlicher (FPV)' if (-not $Verantwortlicher) { - outLogVerbose 'if (-not $Verantwortlicher) -> true' + ### outLogVerbose 'if (-not $Verantwortlicher) -> true' $Verantwortlicher = "0570000/0012" } else { - outLogVerbose 'else -> true (if/elseif (-not $Verantwortlicher) -> false)' + ### outLogVerbose 'else -> true (if/elseif (-not $Verantwortlicher) -> false)' if ( $Verantwortlicher.StartsWith("S" + $SPKNO)) { - outLogVerbose 'if ($Verantwortlicher.StartsWith("S" + $SPKNO)) -> true' + ### outLogVerbose 'if ($Verantwortlicher.StartsWith("S" + $SPKNO)) -> true' $dum = $mitarbeiterStelle_array.Item($Verantwortlicher) $Verantwortlicher = $dum } @@ -918,10 +918,10 @@ function ProcessADObjects if ($MyKey[1]) { - outLogVerbose 'if ($MyKey[1]) -> true' + ### outLogVerbose 'if ($MyKey[1]) -> true' if (-not $nummer_array.ContainsKey($MyKey[1])) { - outLogVerbose 'if (-not $nummer_array.ContainsKey($MyKey[1])) -> true' + ### outLogVerbose 'if (-not $nummer_array.ContainsKey($MyKey[1])) -> true' $nummer_array[$MyKey[1]] = $item.'Nr.' $verantwortlicher_array[$MyKey[1]] = $Verantwortlicher $kz_array[$MyKey[1]] = $item.'AWK' @@ -935,19 +935,19 @@ function ProcessADObjects $AppAccessEntriesNew = [System.Collections.Generic.List[object]]::new() foreach ($item in $AppAccessEntries) { - outLogVerbose 'foreach $item in $AppAccessEntries:' $item.Name + outLog ('[$roletypeTag -ieq $FI.TypeTagAppAccess] foreach $item in $AppAccessEntries: ' + $item.Name) $AWNR = $nummer_array.Item($item.Name) if (-not $AWNR) { - outLogVerbose 'if (-not $AWNR) -> true' + ### outLogVerbose 'if (-not $AWNR) -> true' $AWNR = 9000 } $AWNR = ([string]$AWNR).PadLeft(4, '0') $ShortCut = "AZ_" if ( $item.Name.Contains("GGF-")) { - outLogVerbose 'if ($item.Name.Contains("GGF-")) -> true' + ### outLogVerbose 'if ($item.Name.Contains("GGF-")) -> true' $ShortCut = "AZ_" } @@ -965,16 +965,16 @@ function ProcessADObjects foreach ($item in $AppAccessEntriesNew) { - outLogVerbose 'foreach $item in $AppAccessEntriesNew:' $item.OldName + outLog ('[$roletypeTag -ieq $FI.TypeTagAppAccess] foreach $item in $AppAccessEntriesNew: ' + $item.OldName) $roleType = "unknown" $relevantRoleTypes = $SPK.GroupManagementMappings | Where-Object { $_.OU -ieq $FI.TypeTagAppAccess } | Sort-Object { [int]$_.Order } foreach ($relevantRoleType in $relevantRoleTypes) { - outLogVerbose 'foreach $relevantRoleType in $relevantRoleTypes:' $relevantRoleType.TypeName + ### outLogVerbose 'foreach $relevantRoleType in $relevantRoleTypes:' $relevantRoleType.TypeName if ($item.OldName -cmatch $relevantRoleType.TagRegExp) { - outLogVerbose 'if ($item.OldName -cmatch $relevantRoleType.TagRegExp) -> true' + ### outLogVerbose 'if ($item.OldName -cmatch $relevantRoleType.TagRegExp) -> true' $roleType = $relevantRoleType.TypeName break } @@ -982,7 +982,7 @@ function ProcessADObjects if ($item.OldName -like "*GGT-0-*") { - outLogVerbose 'if ($item.OldName -like "*GGT-0-*") -> true' + ### outLogVerbose 'if ($item.OldName -like "*GGT-0-*") -> true' $roleType = "ApplicationSIA" } @@ -995,7 +995,7 @@ function ProcessADObjects if ($item.'GUIADGroup.Name' -like "*GGX-A_*") { - outLogVerbose 'if ($item.''GUIADGroup.Name'' -like "*GGX-A_*") -> true' + ### outLogVerbose 'if ($item.''GUIADGroup.Name'' -like "*GGX-A_*") -> true' $PnrStr = ([string]$ProfilNummerAZ).PadLeft(3, '0') $AWNR = ([string]$nummer_array.Item($item.OldName)).PadLeft(4, '0') $ProfilName = "Anwendungszugriff " + $item.'GUIADGroup.Name' @@ -1009,34 +1009,34 @@ function ProcessADObjects if ($dum) { - outLogVerbose 'if ($dum) -> true' + ### outLogVerbose 'if ($dum) -> true' if ($dum.StartsWith("S" + $SPKNO)) { - outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' + ### outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' $dum = $mitarbeiterStelle_array.Item($verantwortlicher_array.Item($item.OldName)) } } else { - outLogVerbose 'else -> true (if/elseif ($dum) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($dum) -> false)' $dum = "0570000/0012" } if ( $pkey_array.ContainsKey("PAZ_" + $AWNR)) { - outLogVerbose 'if ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> true' + ### outLogVerbose 'if ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> true' $pkey_array.Item("PAZ_" + $AWNR)++ } else { - outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> false)' $pkey_array.Add("PAZ_" + $AWNR, 1000) } if ($AWNR -ieq "0000") { - outLogVerbose 'if ($AWNR -ieq "0000") -> true' + ### outLogVerbose 'if ($AWNR -ieq "0000") -> true' $AWNR = "9000" } @@ -1050,7 +1050,7 @@ function ProcessADObjects } else { - outLogVerbose 'else -> true (if/elseif ($item.''GUIADGroup.Name'' -like "*GGX-A_*") -> false)' + ### outLogVerbose 'else -> true (if/elseif ($item.''GUIADGroup.Name'' -like "*GGX-A_*") -> false)' $AWK = "1" $PnrStr = ([string]$ProfilNummerAV).PadLeft(3, '0') $AWNR = ([string]$nummer_array.Item($item.OldName)).PadLeft(4, '0') @@ -1067,12 +1067,12 @@ function ProcessADObjects if (-not $NeueBeschreibung) { - outLogVerbose 'if (-not $NeueBeschreibung) -> true' + ### outLogVerbose 'if (-not $NeueBeschreibung) -> true' $ProfilName = "Anwendungszugriff " + $item.'GUIADGroup.Name' } else { - outLogVerbose 'else -> true (if/elseif (-not $NeueBeschreibung) -> false)' + ### outLogVerbose 'else -> true (if/elseif (-not $NeueBeschreibung) -> false)' $ProfilName = $NeueBeschreibung } @@ -1080,33 +1080,33 @@ function ProcessADObjects if ($dum) { - outLogVerbose 'if ($dum) -> true' + ### outLogVerbose 'if ($dum) -> true' if ($dum.StartsWith("S" + $SPKNO)) { - outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' + ### outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' $dum = $mitarbeiterStelle_array.Item($verantwortlicher_array.Item($item.OldName)) } } else { - outLogVerbose 'else -> true (if/elseif ($dum) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($dum) -> false)' $dum = "0570000/0012" } if (-not $kz) { - outLogVerbose 'if (-not $kz) -> true' + ### outLogVerbose 'if (-not $kz) -> true' $kz = "XXXXX" } if ( $pkey_array.ContainsKey("PAZ_" + $AWNR)) { - outLogVerbose 'if ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> true' + ### outLogVerbose 'if ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> true' $pkey_array.Item("PAZ_" + $AWNR)++ } else { - outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> false)' $pkey_array.Add("PAZ_" + $AWNR, 100) } @@ -1118,7 +1118,7 @@ function ProcessADObjects if ($AWNR -ieq "0000") { - outLogVerbose 'if ($AWNR -ieq "0000") -> true' + ### outLogVerbose 'if ($AWNR -ieq "0000") -> true' $AWNR = "9998" } @@ -1133,14 +1133,14 @@ function ProcessADObjects foreach ($item1 in $ADObjectMemberships) { - outLogVerbose 'foreach $item1 in $ADObjectMemberships:' $item1.GroupName + ### outLogVerbose 'foreach $item1 in $ADObjectMemberships:' $item1.GroupName if ($item1.GroupName -ieq $item.OldName) { - outLogVerbose 'if ($item1.GroupName -ieq $item.OldName) -> true' + ### outLogVerbose 'if ($item1.GroupName -ieq $item.OldName) -> true' if ($item1.MemberClass -ieq "user") { - outLogVerbose 'if ($item1.MemberClass -ieq "user") -> true' + ### outLogVerbose 'if ($item1.MemberClass -ieq "user") -> true' $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $item1.MemberName + ";" + "" + ";" + "" + ";" + "user" + ";" + $item.OldName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) @@ -1148,7 +1148,7 @@ function ProcessADObjects $dum = $mitarbeiter_array.Item($item1.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $item1.MemberName } $KURSIstMitarbeiterProfileOutLine = $dum + ";" + $item.OldName + ";" + ($ProfilNummer).ToString() + ";" + "AppAccess" @@ -1156,11 +1156,11 @@ function ProcessADObjects } elseif ($item1.MemberClass -ieq "group") { - outLogVerbose 'elseif ($item1.MemberClass -ieq "group") -> true' + ### outLogVerbose 'elseif ($item1.MemberClass -ieq "group") -> true' $users = getUsersByMemberGroup $item1.MemberName foreach ($u in $users) { - outLogVerbose 'foreach $u in $users:' $u.MemberName + ### outLogVerbose 'foreach $u in $users:' $u.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $u.MemberName + ";" + "" + ";" + "" + ";" + "group" + ";" + $item.OldName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) } @@ -1178,10 +1178,10 @@ function ProcessADObjects } elseif ($roletypeTag -ieq $FI.TypeTagAppConfiguration) { - outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagAppConfiguration) -> true' + ### outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagAppConfiguration) -> true' foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.ObjectName + outLog ('[$roletypeTag -ieq $FI.TypeTagAppConfiguration] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.ObjectName) $DisplayName = $adObjectEntry.ShortCut + $adObjectEntry.ObjectName.Substring($adObjectEntry.ObjectName.IndexOf('-') + 1) @@ -1193,33 +1193,33 @@ function ProcessADObjects if ( $NewFullName.Contains("IntExK")) { - outLogVerbose 'if ($NewFullName.Contains("IntExK")) -> true' + ### outLogVerbose 'if ($NewFullName.Contains("IntExK")) -> true' continue } if ($DisplayName -eq "AK_WEB_SSKMG-STD") { - outLogVerbose 'if ($DisplayName -eq "AK_WEB_SSKMG-STD") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_WEB_SSKMG-STD") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_SSKMG-STD" } if ($DisplayName -eq "AK_IEK_Admins") { - outLogVerbose 'if ($DisplayName -eq "AK_IEK_Admins") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_IEK_Admins") -> true' $NewFullName = $Institut + "GGX-AKE_IntExK_Admins" } if ($DisplayName -eq "AK_OFK_Office_Default") { - outLogVerbose 'if ($DisplayName -eq "AK_OFK_Office_Default") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_OFK_Office_Default") -> true' $NewFullName = $Institut + "GGX-AKO_OFFK_Office_Default" } if ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") { - outLogVerbose 'if ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_IE_ALT_Videoueberwachung" } if ($DisplayName -eq "AK_WEB_OhneIntranet") { - outLogVerbose 'if ($DisplayName -eq "AK_WEB_OhneIntranet") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_WEB_OhneIntranet") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_OhneIntranet" } @@ -1240,7 +1240,7 @@ function ProcessADObjects foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.ObjectName + outLog ('[$roletypeTag -ieq $FI.TypeTagAppConfiguration] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.ObjectName) $DisplayName = $adObjectEntry.ShortCut + $adObjectEntry.ObjectName.Substring($adObjectEntry.ObjectName.IndexOf('-') + 1) $TempString = $adObjectEntry.ObjectName.Split('-') $adObjectEntry.GroupName = $TempString[0] + '-' + $DisplayName @@ -1249,37 +1249,37 @@ function ProcessADObjects $NewFullName = $Institut + $DisplayName if ($DisplayName -eq "AK_WEB_SSKMG-STD") { - outLogVerbose 'if ($DisplayName -eq "AK_WEB_SSKMG-STD") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_WEB_SSKMG-STD") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_SSKMG-STD" $MPNR = 500000001 } elseif ($DisplayName -eq "AK_IEK_Admins") { - outLogVerbose 'elseif ($DisplayName -eq "AK_IEK_Admins") -> true' + ### outLogVerbose 'elseif ($DisplayName -eq "AK_IEK_Admins") -> true' $NewFullName = $Institut + "GGX-AKE_IntExK_Admins" $MPNR = 500000002 } elseif ($DisplayName -eq "AK_OFK_Office_Default") { - outLogVerbose 'elseif ($DisplayName -eq "AK_OFK_Office_Default") -> true' + ### outLogVerbose 'elseif ($DisplayName -eq "AK_OFK_Office_Default") -> true' $NewFullName = $Institut + "GGX-AKO_OFFK_Office_Default" $MPNR = 500000003 } elseif ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") { - outLogVerbose 'elseif ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") -> true' + ### outLogVerbose 'elseif ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_IE_ALT_Videoueberwachung" $MPNR = 500000004 } elseif ($DisplayName -eq "AK_WEB_OhneIntranet") { - outLogVerbose 'elseif ($DisplayName -eq "AK_WEB_OhneIntranet") -> true' + ### outLogVerbose 'elseif ($DisplayName -eq "AK_WEB_OhneIntranet") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_OhneIntranet" $MPNR = 500000005 } else { - outLogVerbose 'else -> true (if/elseif ($DisplayName -eq "AK_WEB_OhneIntranet") -> false)' + ### outLogVerbose 'else -> true (if/elseif ($DisplayName -eq "AK_WEB_OhneIntranet") -> false)' $NewFullName = $DisplayName $MPNR = $DUMPNR } @@ -1303,7 +1303,7 @@ function ProcessADObjects foreach ($userMemberShip in $userMemberShips) { - outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName + ### outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $NewFullName + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) @@ -1313,14 +1313,14 @@ function ProcessADObjects if ($userMemberShip.Origin -ieq "user") { - outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' + ### outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' try { $persnr = $mitarbeiter_array.Item($userMemberShip.MemberName) $dum = $mitarbeiter_array.Item($userMemberShip.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $userMemberShip.MemberName } $persnr = $dum @@ -1340,7 +1340,7 @@ function ProcessADObjects } elseif ($roletypeTag -ieq $FI.TypeTagOrganisation) { - outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagOrganisation) -> true' + ### outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagOrganisation) -> true' $i = 1 $ProfilNummer = 1 @@ -1348,7 +1348,7 @@ function ProcessADObjects foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.ObjectName + outLog ('[$roletypeTag -ieq $FI.TypeTagOrganisation] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.ObjectName) $DisplayName = $adObjectEntry.ShortCut + $adObjectEntry.ObjectName.Substring($adObjectEntry.ObjectName.IndexOf('-') + 1) $TempString = $adObjectEntry.ObjectName.Split('-') @@ -1384,7 +1384,7 @@ function ProcessADObjects $userMemberShips = @(getAllUserMemberships $adObjectEntry) foreach ($userMemberShip in $userMemberShips) { - outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName + ### outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) @@ -1393,14 +1393,14 @@ function ProcessADObjects if ($userMemberShip.Origin -ieq "user") { - outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' + ### outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' try { $persnr = $mitarbeiter_array.Item($userMemberShip.MemberName) $dum = $mitarbeiter_array.Item($userMemberShip.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $userMemberShip.MemberName } $persnr = $dum @@ -1421,25 +1421,25 @@ function ProcessADObjects elseif ($roletypeTag -ieq $FI.TypeTagSecurity) { - outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagSecurity) -> true' + ### outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagSecurity) -> true' $SicherheitseinstellungenFilePath = $SecurityInFilePath $SicherheitseinstellungenFilePathEntries = Get-Content -Path $SicherheitseinstellungenFilePath | ConvertFrom-Csv -Delimiter ";" $sec_array = @{ "nummer" = "nummer" } foreach ($item in $SicherheitseinstellungenFilePathEntries) { - outLogVerbose 'foreach $item in $SicherheitseinstellungenFilePathEntries:' $item.Name + outLog ('[$roletypeTag -ieq $FI.TypeTagSecurity] foreach $item in $SicherheitseinstellungenFilePathEntries: ' + $item.Name) $sec_array[$item.Name] = $item.Verantwortlicher } foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.OldName + outLog ('[$roletypeTag -ieq $FI.TypeTagSecurity] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.OldName) $adObjectEntry.OldName = $adObjectEntry.ObjectName if ( $adObjectEntry.OldName.Contains($SPKID + "GDT")) { - outLogVerbose 'if ($adObjectEntry.OldName.Contains($SPKID + "GDT")) -> true' + ### outLogVerbose 'if ($adObjectEntry.OldName.Contains($SPKID + "GDT")) -> true' continue } @@ -1463,7 +1463,7 @@ function ProcessADObjects $pnRules = [System.Collections.Generic.List[object]]::new() foreach ($row in $SPK.ProfileNumberMappings) { - outLogVerbose 'foreach $row in $SPK.ProfileNumberMappings:' $row + outLog ('[$roletypeTag -ieq $FI.TypeTagSecurity] foreach $row in $SPK.ProfileNumberMappings: ' + $row) $pnRules.Add([pscustomobject]@{ Pattern = $row.Pattern PN = $pnPrefix1 + $pnPrefix2 + $row.Suffix @@ -1477,12 +1477,12 @@ function ProcessADObjects foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.OldName + outLog ('[$roletypeTag -ieq $FI.TypeTagSecurity] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.OldName) if ( $adObjectEntry.OldName.Contains($SPKID + "GDT")) { - outLogVerbose 'if ($adObjectEntry.OldName.Contains($SPKID + "GDT")) -> true' + ### outLogVerbose 'if ($adObjectEntry.OldName.Contains($SPKID + "GDT")) -> true' continue } @@ -1500,17 +1500,17 @@ function ProcessADObjects $PN = $null foreach ($rule in $pnRules) { - outLogVerbose 'foreach $rule in $pnRules:' $rule + ### outLogVerbose 'foreach $rule in $pnRules:' $rule if ($DisplayName.Contains($rule.Pattern)) { - outLogVerbose 'if ($DisplayName.Contains($rule.Pattern)) -> true' + ### outLogVerbose 'if ($DisplayName.Contains($rule.Pattern)) -> true' $PN = $rule.PN break } } if ($null -eq $PN) { - outLogVerbose 'if ($null -eq $PN) -> true' + ### outLogVerbose 'if ($null -eq $PN) -> true' $PN = ($ProfilNummerSonstigesStartWert + $iSonstiges).ToString() $iSonstiges++ } @@ -1526,7 +1526,7 @@ function ProcessADObjects foreach ($userMemberShip in $userMemberShips) { - outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName + ### outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) @@ -1535,14 +1535,14 @@ function ProcessADObjects if ($userMemberShip.Origin -ieq "user") { - outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' + ### outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' try { $persnr = $mitarbeiter_array.Item($userMemberShip.MemberName) $dum = $mitarbeiter_array.Item($userMemberShip.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $userMemberShip.MemberName } $persnr = $dum @@ -1562,10 +1562,10 @@ function ProcessADObjects elseif ($roletypeTag -ieq $FI.TypeTagRole) { - outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagRole) -> true' + ### outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagRole) -> true' foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.ObjectName + outLog ('[$roletypeTag -ieq $FI.TypeTagRole] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.ObjectName) $DisplayName = $adObjectEntry.ShortCut + $adObjectEntry.ObjectName.Substring($adObjectEntry.ObjectName.IndexOf('-') + 1) $TempString = $adObjectEntry.ObjectName.Split('-') @@ -1589,7 +1589,7 @@ function ProcessADObjects foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.ObjectName + outLog ('[$roletypeTag -ieq $FI.TypeTagRole] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.ObjectName) $DisplayName = $adObjectEntry.ShortCut + $adObjectEntry.ObjectName.Substring($adObjectEntry.ObjectName.IndexOf('-') + 1) $TempString = $adObjectEntry.ObjectName.Split('-') $adObjectEntry.GroupName = $TempString[0] + '-' + $DisplayName @@ -1598,21 +1598,21 @@ function ProcessADObjects if (-not ($adObjectEntry.OldName.StartsWith($SPKID + "GUX")) -and -not (testKnownPrefixes $adObjectEntry.OldName $prefixMatcher)) { - outLogVerbose 'if (-not ($adObjectEntry.OldName.StartsWith($SPKID + "GUX")) -and -not (testKnownPrefixes $adObjectEntry.OldName $ ...) -> true' + ### outLogVerbose 'if (-not ($adObjectEntry.OldName.StartsWith($SPKID + "GUX")) -and -not (testKnownPrefixes $adObjectEntry.OldName $ ...) -> true' continue } $roleType = getRoleType $adObjectEntry $roletypeTag if ( $NewFullName.Contains("R_LM_")) { - outLogVerbose 'if ($NewFullName.Contains("R_LM_")) -> true' + ### outLogVerbose 'if ($NewFullName.Contains("R_LM_")) -> true' $PN = ($ProfilNummerLM).ToString() $ProfilNummerLM++ $NewFullName = $NewFullName.Replace("AR_LM_", "LM_") } else { - outLogVerbose 'else -> true (if/elseif ($NewFullName.Contains("R_LM_")) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($NewFullName.Contains("R_LM_")) -> false)' $PN = ($ProfilNummer + $iSonstiges).ToString() $iSonstiges++ } @@ -1626,10 +1626,10 @@ function ProcessADObjects if (1 -lt 2) { - outLogVerbose 'if (1 -lt 2) -> true' + ### outLogVerbose 'if (1 -lt 2) -> true' foreach ($userMemberShip in $userMemberShips) { - outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName + ### outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) @@ -1638,14 +1638,14 @@ function ProcessADObjects if ($userMemberShip.Origin -ieq "user") { - outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' + ### outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' try { $persnr = $mitarbeiter_array.Item($userMemberShip.MemberName) $dum = $mitarbeiter_array.Item($userMemberShip.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $userMemberShip.MemberName } $persnr = $dum @@ -1670,29 +1670,33 @@ function ProcessADObjects $DAWGruppenverwaltungOutList.Sort($ordinalComparer) $KURSSollProfileOutList.Sort($ordinalComparer) $KURSIstMitarbeiterProfileOutList.Sort($ordinalComparer) + removeDuplicatesFromSortedList $DAWGruppenAnlegenOutList "DAWGruppenAnlegenOutList" + removeDuplicatesFromSortedList $DAWGruppenverwaltungOutList "DAWGruppenverwaltungOutList" + removeDuplicatesFromSortedList $KURSSollProfileOutList "KURSSollProfileOutList" + removeDuplicatesFromSortedList $KURSIstMitarbeiterProfileOutList "KURSIstMitarbeiterProfileOutList" $DAWGruppenverwaltungNeuOutList.Clear() $lastLdap = $null foreach ($outLine in $DAWGruppenverwaltungOutList) { - outLogVerbose 'foreach $outLine in $DAWGruppenverwaltungOutList:' $outLine + ### outLogVerbose 'foreach $outLine in $DAWGruppenverwaltungOutList:' $outLine $cols = $outLine.Split(";") if ([string]::IsNullOrEmpty($cols[5])) { - outLogVerbose 'if ([string]::IsNullOrEmpty($cols[5])) -> true' + ### outLogVerbose 'if ([string]::IsNullOrEmpty($cols[5])) -> true' $DAWGruppenverwaltungNeuOutList.Add($outLine) $lastLdap = $null continue } if ($cols[2] -cne $lastLdap) { - outLogVerbose 'if ($cols[2] -cne $lastLdap) -> true' + ### outLogVerbose 'if ($cols[2] -cne $lastLdap) -> true' $DAWGruppenverwaltungNeuOutList.Add($outLine) $lastLdap = $cols[2] } else { - outLogVerbose 'else -> true (if/elseif ($cols[2] -cne $lastLdap) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($cols[2] -cne $lastLdap) -> false)' $DAWGruppenverwaltungNeuOutList.Add(";;;;;" + $cols[5] + ";;;;") } } diff --git a/Process-ADObjects-Work-Y015.ps1 b/Process-ADObjects-Work-Y015.ps1 index cc682f7..8dc21ba 100644 --- a/Process-ADObjects-Work-Y015.ps1 +++ b/Process-ADObjects-Work-Y015.ps1 @@ -8,7 +8,7 @@ function ProcessADObjects [String] $roletypeTag ) $begin = Get-Date - outLog ("ProcessADObjects called at: "+ + $begin + $init) + outLog ("ProcessADObjects called at: " + $begin + $init) $adObjectEntries | Add-Member OldName "" $adObjectEntries | Add-Member GroupName "" @@ -25,10 +25,10 @@ function ProcessADObjects $mitarbeiterStelle_array = @{"mitarbeiter" = "stelle"} foreach ($item in $MitarbeiterEntries) { - outLogVerbose 'foreach $item in $MitarbeiterEntries:' $item.'St.-Nr.' + outLog ('foreach $item in $MitarbeiterEntries: ' + $item.'St.-Nr.') if ([System.String]::IsNullOrEmpty($item.Benutzerkennung)) { - outLogVerbose 'if ([System.String]::IsNullOrEmpty($item.Benutzerkennung)) -> true' + ### outLogVerbose 'if ([System.String]::IsNullOrEmpty($item.Benutzerkennung)) -> true' continue } try @@ -51,7 +51,7 @@ function ProcessADObjects if ($roletypeTag -ieq $FI.TypeTagFilesystemAccess) { - outLogVerbose 'if ($roletypeTag -ieq $FI.TypeTagFilesystemAccess) -> true' + ### outLogVerbose 'if ($roletypeTag -ieq $FI.TypeTagFilesystemAccess) -> true' try @@ -65,10 +65,10 @@ function ProcessADObjects foreach ($item in $AnwendungenFilePathEntries) { - outLogVerbose 'foreach $item in $AnwendungenFilePathEntries:' $item.Verzeichnisname + outLog ('[$roletypeTag -ieq $FI.TypeTagFilesystemAccess] foreach $item in $AnwendungenFilePathEntries: ' + $item.Verzeichnisname) if ([System.String]::IsNullOrEmpty($item.Verzeichnisname)) { - outLogVerbose 'if ([System.String]::IsNullOrEmpty($item.Verzeichnisname)) -> true' + ### outLogVerbose 'if ([System.String]::IsNullOrEmpty($item.Verzeichnisname)) -> true' continue } try @@ -99,7 +99,7 @@ function ProcessADObjects foreach ($item in $DirectoriesFilePathEntries) { - outLogVerbose 'foreach $item in $DirectoriesFilePathEntries:' $item.Verzeichnisname + outLog ('[$roletypeTag -ieq $FI.TypeTagFilesystemAccess] foreach $item in $DirectoriesFilePathEntries: ' + $item.Verzeichnisname) try { @@ -167,11 +167,11 @@ function ProcessADObjects foreach ($item in $FileSystemAccessEntries) { - outLogVerbose 'foreach $item in $FileSystemAccessEntries:' $item.Name + outLog ('[$roletypeTag -ieq $FI.TypeTagFilesystemAccess] foreach $item in $FileSystemAccessEntries: ' + $item.Name) if ($item.Name.Contains("GGF-VDA-")) { - outLogVerbose 'if ($item.Name.Contains("GGF-VDA-")) -> true' + ### outLogVerbose 'if ($item.Name.Contains("GGF-VDA-")) -> true' continue } @@ -183,17 +183,17 @@ function ProcessADObjects $EndString = "" if ($item.Name.EndsWith("_L")) { - outLogVerbose 'if ($item.Name.EndsWith("_L")) -> true' + ### outLogVerbose 'if ($item.Name.EndsWith("_L")) -> true' $EndString = "_L" } elseif ($item.Name.EndsWith("_A")) { - outLogVerbose 'elseif ($item.Name.EndsWith("_A")) -> true' + ### outLogVerbose 'elseif ($item.Name.EndsWith("_A")) -> true' $EndString = "_A" } else { - outLogVerbose 'else -> true (if/elseif ($item.Name.EndsWith("_A")) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($item.Name.EndsWith("_A")) -> false)' $EndString = "_X" } @@ -208,43 +208,43 @@ function ProcessADObjects if ($art_array.Item($item.Name) -ieq "FAC123") { - outLogVerbose 'if ($art_array.Item($item.Name) -ieq "FAC123") -> true' + ### outLogVerbose 'if ($art_array.Item($item.Name) -ieq "FAC123") -> true' $V = "FAC_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "AUS123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "AUS123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "AUS123") -> true' $V = "AUS_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "PKU123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "PKU123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "PKU123") -> true' $V = "PKU_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "SON123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "SON123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "SON123") -> true' $V = "SON_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "UBE123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "UBE123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "UBE123") -> true' $V = "UBE_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "UNT123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "UNT123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "UNT123") -> true' $V = "UNT_" $V = "" } elseif ($art_array.Item($item.Name) -ieq "VAW123") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "VAW123") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "VAW123") -> true' $V = "VAW_" $AWNRNEW = "9997" @@ -255,7 +255,7 @@ function ProcessADObjects $AWNRNEW = $dnummer_array.Item($item.Name).PadLeft(4, '0') if(-not $AWNRNEW) { - outLogVerbose 'if (-not $AWNRNEW) -> true' + ### outLogVerbose 'if (-not $AWNRNEW) -> true' $AWNRNEW = "9997" } } @@ -270,7 +270,7 @@ function ProcessADObjects if(-not $DKZ) { - outLogVerbose 'if (-not $DKZ) -> true' + ### outLogVerbose 'if (-not $DKZ) -> true' $DKZ = "XXXXX" } } @@ -286,26 +286,26 @@ function ProcessADObjects if ($art_array.Contains($item.Name)) { - outLogVerbose 'if ($art_array.Contains($item.Name)) -> true' + ### outLogVerbose 'if ($art_array.Contains($item.Name)) -> true' if ($art_array.Item($item.Name) -ieq "Programm-Ablage") { - outLogVerbose 'if ($art_array.Item($item.Name) -ieq "Programm-Ablage") -> true' + ### outLogVerbose 'if ($art_array.Item($item.Name) -ieq "Programm-Ablage") -> true' $NewShortName = $V } elseif ($art_array.Item($item.Name) -ieq "VAW") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "VAW") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "VAW") -> true' $NewShortName = $V } elseif ($art_array.Item($item.Name) -ieq "PRG") { - outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "PRG") -> true' + ### outLogVerbose 'elseif ($art_array.Item($item.Name) -ieq "PRG") -> true' try { $AWNRNEW = $dnummer_array.Item($item.Name).PadLeft(4, '0') if(-not $AWNRNEW) { - outLogVerbose 'if (-not $AWNRNEW) -> true' + ### outLogVerbose 'if (-not $AWNRNEW) -> true' $AWNRNEW = "9998" } } @@ -319,22 +319,22 @@ function ProcessADObjects } else { - outLogVerbose 'else -> true (if/elseif ($art_array.Item($item.Name) -ieq "PRG") -> false)' + ### outLogVerbose 'else -> true (if/elseif ($art_array.Item($item.Name) -ieq "PRG") -> false)' $NewShortName = $V + $path_array.Item($item.Name) + $EndString } } else { - outLogVerbose 'else -> true (if/elseif ($art_array.Contains($item.Name)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($art_array.Contains($item.Name)) -> false)' $test = $item.Name.Substring(0, $item.Name.Length - 2) if ($key_array.ContainsKey($test)) { - outLogVerbose 'if ($key_array.ContainsKey($test)) -> true' + ### outLogVerbose 'if ($key_array.ContainsKey($test)) -> true' } else { - outLogVerbose 'else -> true (if/elseif ($key_array.ContainsKey($test)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($key_array.ContainsKey($test)) -> false)' $cntNichtGelistet++ $key_array.Add($test, $cntNichtGelistet) } @@ -348,7 +348,7 @@ function ProcessADObjects if ($Description.Contains("## keine Beschreibung ##")) { - outLogVerbose 'if ($Description.Contains("## keine Beschreibung ##")) -> true' + ### outLogVerbose 'if ($Description.Contains("## keine Beschreibung ##")) -> true' $VA = $verantwortlicher_array.Item($item.Name) $Description = $Description + " Verantwortlicher: " + $VA } @@ -369,7 +369,7 @@ function ProcessADObjects foreach ($item in $FileSystemAccessEntriesNew) { - outLogVerbose 'foreach $item in $FileSystemAccessEntriesNew:' $item.OldName + outLog ('[$roletypeTag -ieq $FI.TypeTagFilesystemAccess] foreach $item in $FileSystemAccessEntriesNew: ' + $item.OldName) $item | Out-String @@ -378,10 +378,10 @@ function ProcessADObjects $relevantRoleTypes = $SPK.GroupManagementMappings | Where-Object { $_.OU -ieq $FI.TypeTagFilesystemAccess } | Sort-Object { [int]$_.Order } foreach ($relevantRoleType in $relevantRoleTypes) { - outLogVerbose 'foreach $relevantRoleType in $relevantRoleTypes:' $relevantRoleType.TypeName + ### outLogVerbose 'foreach $relevantRoleType in $relevantRoleTypes:' $relevantRoleType.TypeName if ($item.OldName -cmatch $relevantRoleType.TagRegExp) { - outLogVerbose 'if ($item.OldName -cmatch $relevantRoleType.TagRegExp) -> true' + ### outLogVerbose 'if ($item.OldName -cmatch $relevantRoleType.TagRegExp) -> true' $roleType = $relevantRoleType.TypeName break } @@ -402,7 +402,7 @@ function ProcessADObjects if(-not $DKZ) { - outLogVerbose 'if (-not $DKZ) -> true' + ### outLogVerbose 'if (-not $DKZ) -> true' $MYANR = "9997" } } @@ -423,7 +423,7 @@ function ProcessADObjects $AWNRNEW = $dnummer_array.Item($item.OldName).PadLeft(4, '0') if(-not $AWNRNEW) { - outLogVerbose 'if (-not $AWNRNEW) -> true' + ### outLogVerbose 'if (-not $AWNRNEW) -> true' $AWNRNEW = "9998" } } @@ -435,126 +435,126 @@ function ProcessADObjects if ($VerzeichnisArt -ieq "SPA") { - outLogVerbose 'if ($VerzeichnisArt -ieq "SPA") -> true' + ### outLogVerbose 'if ($VerzeichnisArt -ieq "SPA") -> true' $ProfilNummer = "72" + ([string]$CntSPA).PadLeft(7, '0') $CntSPA++ $ProfilName = "SPA " + $NewFullName if ($NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf SPA aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf SPA lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "SON") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "SON") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "SON") -> true' $ProfilNummer = "72" + ([string]$CntSON).PadLeft(7, '0') $CntSON++ $ProfilName = "SON " + $NewFullName if ($NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf SON aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf SON lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "SPK") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "SPK") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "SPK") -> true' $ProfilNummer = "72" + ([string]$CntSPK).PadLeft(7, '0') $CntSPK++ $ProfilName = "SPK " + $NewFullName if ($NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf SPK aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf SPK lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "VRZ") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "VRZ") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "VRZ") -> true' $ProfilNummer = "72" + ([string]$CntVRZ).PadLeft(7, '0') $CntVRZ++ $ProfilName = "VRZ " + $NewFullName if ($NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf VRZ aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf VRZ lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "VOE") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "VOE") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "VOE") -> true' $ProfilNummer = "72" + ([string]$CntVOE).PadLeft(7, '0') $CntVOE++ $ProfilName = "VOE " + $NewFullName if ($NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf VOE aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf VOE lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "PRG") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "PRG") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "PRG") -> true' if ($AWNRNEW -ieq "9997") { - outLogVerbose 'if ($AWNRNEW -ieq "9997") -> true' + ### outLogVerbose 'if ($AWNRNEW -ieq "9997") -> true' $ProfilNummer = "72" + ([string]$CntPRG).PadLeft(7, '0') $CntPRG++ } elseif ($AWNRNEW -ieq "0000") { - outLogVerbose 'elseif ($AWNRNEW -ieq "0000") -> true' + ### outLogVerbose 'elseif ($AWNRNEW -ieq "0000") -> true' $ProfilNummer = "72" + ([string]$CntPRG).PadLeft(7, '0') $CntPRG++ } else { - outLogVerbose 'else -> true (if/elseif ($AWNRNEW -ieq "0000") -> false)' + ### outLogVerbose 'else -> true (if/elseif ($AWNRNEW -ieq "0000") -> false)' if ($rbkey_array.ContainsKey("PAN_" + $AWNRNEW)) { - outLogVerbose 'if ($rbkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> true' + ### outLogVerbose 'if ($rbkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> true' $rbkey_array.Item("PAN_" + $AWNRNEW)++ } else { - outLogVerbose 'else -> true (if/elseif ($rbkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($rbkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> false)' $rbkey_array.Add("PAN_" + $AWNRNEW, 200) } @@ -566,69 +566,69 @@ function ProcessADObjects $ProfilName = "SIA " + $NewFullName if ($NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf SIA aendern " + $NewFullName.Replace($SPKID + "GGX-", "") } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf SIA lesen " + $NewFullName.Replace($SPKID + "GGX-", "") } } elseif ($VerzeichnisArt -ieq "PRG12") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "PRG12") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "PRG12") -> true' $ProfilNummer = "72" + ([string]$CntPRG).PadLeft(7, '0') $CntPRG++ $ProfilName = "PROG " + $NewFullName if ($NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf PRG aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf PRG lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "VRZ") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "VRZ") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "VRZ") -> true' $ProfilNummer = "72" + ([string]$CntVRZ).PadLeft(7, '0') $CntVRZ++ $ProfilName = "VRZ " + $NewFullName if ($NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf VRZ aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf VRZ lesen " + $NewFullName } } elseif ($VerzeichnisArt -ieq "SPK") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "SPK") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "SPK") -> true' $ProfilNummer = "72" + ([string]$CntSPK).PadLeft(7, '0') $CntSPK++ $ProfilName = "SPK " + $NewFullName if ($NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf SPK aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf SPK lesen " + $NewFullName } @@ -636,19 +636,19 @@ function ProcessADObjects elseif ($VerzeichnisArt -ieq "PROG1") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "PROG1") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "PROG1") -> true' $ProfilNummer = $CntProgramm $CntProgramm++ $ProfilName = "Anwendungsverzeichnis " + $NewFullName if ($NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf Programm aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf Programm lesen " + $NewFullName } @@ -660,7 +660,7 @@ function ProcessADObjects $AWNRNEW = $dnummer_array.Item($item.OldName).PadLeft(4, '0') if(-not $AWNRNEW) { - outLogVerbose 'if (-not $AWNRNEW) -> true' + ### outLogVerbose 'if (-not $AWNRNEW) -> true' $AWNRNEW = "9997" } @@ -675,7 +675,7 @@ function ProcessADObjects if(-not $DKZ) { - outLogVerbose 'if (-not $DKZ) -> true' + ### outLogVerbose 'if (-not $DKZ) -> true' $DKZ = "XXXXX" } @@ -689,12 +689,12 @@ function ProcessADObjects if ($pkey_array.ContainsKey("PAN_" + $AWNRNEW)) { - outLogVerbose 'if ($pkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> true' + ### outLogVerbose 'if ($pkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> true' $pkey_array.Item("PAN_" + $AWNRNEW)++ } else { - outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAN_" + $AWNRNEW)) -> false)' $pkey_array.Add("PAN_" + $AWNRNEW, 1) } @@ -702,15 +702,15 @@ function ProcessADObjects } elseif ($VerzeichnisArt -ieq "AW") { - outLogVerbose 'elseif ($VerzeichnisArt -ieq "AW") -> true' + ### outLogVerbose 'elseif ($VerzeichnisArt -ieq "AW") -> true' if ($avkey_array.ContainsKey("AV_" + $MYANR)) { - outLogVerbose 'if ($avkey_array.ContainsKey("AV_" + $MYANR)) -> true' + ### outLogVerbose 'if ($avkey_array.ContainsKey("AV_" + $MYANR)) -> true' $avkey_array.Item("AV_" + $MYANR)++ } else { - outLogVerbose 'else -> true (if/elseif ($avkey_array.ContainsKey("AV_" + $MYANR)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($avkey_array.ContainsKey("AV_" + $MYANR)) -> false)' $avkey_array.Add("AV_" + $MYANR, 1) } @@ -721,19 +721,19 @@ function ProcessADObjects $ProfilName = "AW_" + $NewFullName if ($NewFullName.EndsWith("_A")) { - outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' + ### outLogVerbose 'if ($NewFullName.EndsWith("_A")) -> true' $ProfilName = "Zugriff auf Anwendungsverzeichnisse aendern " + $NewFullName } elseif ($NewFullName.EndsWith("_L")) { - outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' + ### outLogVerbose 'elseif ($NewFullName.EndsWith("_L")) -> true' $ProfilName = "Zugriff auf Anwendungsverzeichnisse lesen " + $NewFullName } } else { - outLogVerbose 'else -> true (if/elseif ($VerzeichnisArt -ieq "AW") -> false)' + ### outLogVerbose 'else -> true (if/elseif ($VerzeichnisArt -ieq "AW") -> false)' try { $ProfilNummer = "97000" + ([string]$CntElse).PadLeft(4, '0') @@ -750,16 +750,16 @@ function ProcessADObjects $dum = $verantwortlicher_array.Item($item.OldName) if ($dum) { - outLogVerbose 'if ($dum) -> true' + ### outLogVerbose 'if ($dum) -> true' if ( $dum.StartsWith("S" + $SPKNO)) { - outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' + ### outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' $dum = $mitarbeiterStelle_array.Item($verantwortlicher_array.Item($item.OldName)) } } else { - outLogVerbose 'else -> true (if/elseif ($dum) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($dum) -> false)' $dum = "0570000/0012" } @@ -771,13 +771,13 @@ function ProcessADObjects foreach ($item1 in $ADObjectMemberships) { - outLogVerbose 'foreach $item1 in $ADObjectMemberships:' $item1.GroupName + ### outLogVerbose 'foreach $item1 in $ADObjectMemberships:' $item1.GroupName if ($item1.GroupName -ieq $item.OldName) { - outLogVerbose 'if ($item1.GroupName -ieq $item.OldName) -> true' + ### outLogVerbose 'if ($item1.GroupName -ieq $item.OldName) -> true' if ($item1.MemberClass -ieq "user") { - outLogVerbose 'if ($item1.MemberClass -ieq "user") -> true' + ### outLogVerbose 'if ($item1.MemberClass -ieq "user") -> true' $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $item1.MemberName + ";" + "" + ";" + "" + ";" + "user" + ";" + "" $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) @@ -785,7 +785,7 @@ function ProcessADObjects $dum = $mitarbeiter_array.Item($item1.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $item1.MemberName } $KURSIstMitarbeiterProfileOutLine = $dum + ";" + $item.OldName + ";" + ($ProfilNummer).ToString() + ";" + "FileSystemAccess" @@ -793,11 +793,11 @@ function ProcessADObjects } elseif ($item1.MemberClass -ieq "group") { - outLogVerbose 'elseif ($item1.MemberClass -ieq "group") -> true' + ### outLogVerbose 'elseif ($item1.MemberClass -ieq "group") -> true' $users = getUsersByMemberGroup $item1.MemberName foreach ($u in $users) { - outLogVerbose 'foreach $u in $users:' $u.MemberName + ### outLogVerbose 'foreach $u in $users:' $u.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $u.MemberName + ";" + "" + ";" + "" + ";" + "group" + ";" + $item1.MemberName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) } @@ -818,7 +818,7 @@ function ProcessADObjects elseif ($roletypeTag -ieq $FI.TypeTagAppAccess) { - outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagAppAccess) -> true' + ### outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagAppAccess) -> true' try { @@ -836,21 +836,21 @@ function ProcessADObjects foreach ($item in $AnwendungenFilePathEntries) { - outLogVerbose 'foreach $item in $AnwendungenFilePathEntries:' $item.'Nr.' + outLog ('[$roletypeTag -ieq $FI.TypeTagAppAccess] foreach $item in $AnwendungenFilePathEntries: ' + $item.'Nr.') $Verantwortlicher = $item.'Verantwortlicher (FPV)' if (-not $Verantwortlicher) { - outLogVerbose 'if (-not $Verantwortlicher) -> true' + ### outLogVerbose 'if (-not $Verantwortlicher) -> true' $Verantwortlicher = "0570000/0012" } else { - outLogVerbose 'else -> true (if/elseif (-not $Verantwortlicher) -> false)' + ### outLogVerbose 'else -> true (if/elseif (-not $Verantwortlicher) -> false)' if ( $Verantwortlicher.StartsWith("S" + $SPKNO)) { - outLogVerbose 'if ($Verantwortlicher.StartsWith("S" + $SPKNO)) -> true' + ### outLogVerbose 'if ($Verantwortlicher.StartsWith("S" + $SPKNO)) -> true' $dum = $mitarbeiterStelle_array.Item($Verantwortlicher) $Verantwortlicher = $dum } @@ -861,10 +861,10 @@ function ProcessADObjects if($MyKey[1]) { - outLogVerbose 'if ($MyKey[1]) -> true' + ### outLogVerbose 'if ($MyKey[1]) -> true' if (-not $nummer_array.ContainsKey($MyKey[1])) { - outLogVerbose 'if (-not $nummer_array.ContainsKey($MyKey[1])) -> true' + ### outLogVerbose 'if (-not $nummer_array.ContainsKey($MyKey[1])) -> true' $nummer_array[$MyKey[1]] = $item.'Nr.' $verantwortlicher_array[$MyKey[1]] = $Verantwortlicher $kz_array[$MyKey[1]] = $item.'AWK' @@ -879,19 +879,19 @@ function ProcessADObjects $AppAccessEntriesNew = [System.Collections.Generic.List[object]]::new() foreach ($item in $AppAccessEntries) { - outLogVerbose 'foreach $item in $AppAccessEntries:' $item.Name + outLog ('[$roletypeTag -ieq $FI.TypeTagAppAccess] foreach $item in $AppAccessEntries: ' + $item.Name) $AWNR = $nummer_array.Item($item.Name) if (-not $AWNR) { - outLogVerbose 'if (-not $AWNR) -> true' + ### outLogVerbose 'if (-not $AWNR) -> true' $AWNR = 9000 } $AWNR = ([string]$AWNR).PadLeft(4, '0') $ShortCut = "AZ_" if ($item.Name.Contains("GGF-")) { - outLogVerbose 'if ($item.Name.Contains("GGF-")) -> true' + ### outLogVerbose 'if ($item.Name.Contains("GGF-")) -> true' $ShortCut = "AZ_" } @@ -909,16 +909,16 @@ function ProcessADObjects foreach ($item in $AppAccessEntriesNew) { - outLogVerbose 'foreach $item in $AppAccessEntriesNew:' $item.OldName + outLog ('[$roletypeTag -ieq $FI.TypeTagAppAccess] foreach $item in $AppAccessEntriesNew: ' + $item.OldName) $roleType = "unknown" $relevantRoleTypes = $SPK.GroupManagementMappings | Where-Object { $_.OU -ieq $FI.TypeTagAppAccess } | Sort-Object { [int]$_.Order } foreach ($relevantRoleType in $relevantRoleTypes) { - outLogVerbose 'foreach $relevantRoleType in $relevantRoleTypes:' $relevantRoleType.TypeName + ### outLogVerbose 'foreach $relevantRoleType in $relevantRoleTypes:' $relevantRoleType.TypeName if ($item.OldName -cmatch $relevantRoleType.TagRegExp) { - outLogVerbose 'if ($item.OldName -cmatch $relevantRoleType.TagRegExp) -> true' + ### outLogVerbose 'if ($item.OldName -cmatch $relevantRoleType.TagRegExp) -> true' $roleType = $relevantRoleType.TypeName break } @@ -926,7 +926,7 @@ function ProcessADObjects if($item.OldName -like "*GGT-0-*") { - outLogVerbose 'if ($item.OldName -like "*GGT-0-*") -> true' + ### outLogVerbose 'if ($item.OldName -like "*GGT-0-*") -> true' $roleType = "ApplicationSIA" } @@ -939,7 +939,7 @@ function ProcessADObjects if ($item.'GUIADGroup.Name' -like "*GGX-A_*") { - outLogVerbose 'if ($item.''GUIADGroup.Name'' -like "*GGX-A_*") -> true' + ### outLogVerbose 'if ($item.''GUIADGroup.Name'' -like "*GGX-A_*") -> true' $PnrStr = ([string]$ProfilNummerAZ).PadLeft(3, '0') $AWNR = ([string]$nummer_array.Item($item.OldName)).PadLeft(4, '0') $ProfilName = "Anwendungszugriff " + $item.'GUIADGroup.Name' @@ -953,34 +953,34 @@ function ProcessADObjects if ($dum) { - outLogVerbose 'if ($dum) -> true' + ### outLogVerbose 'if ($dum) -> true' if ($dum.StartsWith("S" + $SPKNO)) { - outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' + ### outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' $dum = $mitarbeiterStelle_array.Item($verantwortlicher_array.Item($item.OldName)) } } else { - outLogVerbose 'else -> true (if/elseif ($dum) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($dum) -> false)' $dum = "0570000/0012" } if ($pkey_array.ContainsKey("PAZ_" + $AWNR)) { - outLogVerbose 'if ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> true' + ### outLogVerbose 'if ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> true' $pkey_array.Item("PAZ_" + $AWNR)++ } else { - outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> false)' $pkey_array.Add("PAZ_" + $AWNR, 1000) } if ($AWNR -ieq "0000") { - outLogVerbose 'if ($AWNR -ieq "0000") -> true' + ### outLogVerbose 'if ($AWNR -ieq "0000") -> true' $AWNR = "9000" } @@ -993,7 +993,7 @@ function ProcessADObjects } else { - outLogVerbose 'else -> true (if/elseif ($item.''GUIADGroup.Name'' -like "*GGX-A_*") -> false)' + ### outLogVerbose 'else -> true (if/elseif ($item.''GUIADGroup.Name'' -like "*GGX-A_*") -> false)' $AWK = "1" $PnrStr = ([string]$ProfilNummerAV).PadLeft(3, '0') $AWNR = ([string]$nummer_array.Item($item.OldName)).PadLeft(4, '0') @@ -1010,12 +1010,12 @@ function ProcessADObjects if (-not $NeueBeschreibung) { - outLogVerbose 'if (-not $NeueBeschreibung) -> true' + ### outLogVerbose 'if (-not $NeueBeschreibung) -> true' $ProfilName = "Anwendungszugriff " + $item.'GUIADGroup.Name' } else { - outLogVerbose 'else -> true (if/elseif (-not $NeueBeschreibung) -> false)' + ### outLogVerbose 'else -> true (if/elseif (-not $NeueBeschreibung) -> false)' $ProfilName = $NeueBeschreibung } @@ -1023,33 +1023,33 @@ function ProcessADObjects if ($dum) { - outLogVerbose 'if ($dum) -> true' + ### outLogVerbose 'if ($dum) -> true' if ($dum.StartsWith("S" + $SPKNO)) { - outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' + ### outLogVerbose 'if ($dum.StartsWith("S" + $SPKNO)) -> true' $dum = $mitarbeiterStelle_array.Item($verantwortlicher_array.Item($item.OldName)) } } else { - outLogVerbose 'else -> true (if/elseif ($dum) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($dum) -> false)' $dum = "0570000/0012" } if (-not $kz) { - outLogVerbose 'if (-not $kz) -> true' + ### outLogVerbose 'if (-not $kz) -> true' $kz = "XXXXX" } if ($pkey_array.ContainsKey("PAZ_" + $AWNR)) { - outLogVerbose 'if ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> true' + ### outLogVerbose 'if ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> true' $pkey_array.Item("PAZ_" + $AWNR)++ } else { - outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($pkey_array.ContainsKey("PAZ_" + $AWNR)) -> false)' $pkey_array.Add("PAZ_" + $AWNR, 100) } @@ -1061,7 +1061,7 @@ function ProcessADObjects if ($AWNR -ieq "0000") { - outLogVerbose 'if ($AWNR -ieq "0000") -> true' + ### outLogVerbose 'if ($AWNR -ieq "0000") -> true' $AWNR = "9998" } @@ -1076,21 +1076,21 @@ function ProcessADObjects foreach ($item1 in $ADObjectMemberships) { - outLogVerbose 'foreach $item1 in $ADObjectMemberships:' $item1.GroupName + ### outLogVerbose 'foreach $item1 in $ADObjectMemberships:' $item1.GroupName if ($item1.GroupName -ieq $item.OldName) { - outLogVerbose 'if ($item1.GroupName -ieq $item.OldName) -> true' + ### outLogVerbose 'if ($item1.GroupName -ieq $item.OldName) -> true' if ($item1.MemberClass -ieq "user") { - outLogVerbose 'if ($item1.MemberClass -ieq "user") -> true' + ### outLogVerbose 'if ($item1.MemberClass -ieq "user") -> true' $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $item1.MemberName + ";" + "" + ";" + "" + ";" + "user" + ";" + $item.OldName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) $dum = $mitarbeiter_array.Item($item1.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $item1.MemberName } $KURSIstMitarbeiterProfileOutLine = $dum + ";" + $item.OldName + ";" + ($ProfilNummer).ToString() + ";" + "AppAccess" @@ -1098,11 +1098,11 @@ function ProcessADObjects } elseif ($item1.MemberClass -ieq "group") { - outLogVerbose 'elseif ($item1.MemberClass -ieq "group") -> true' + ### outLogVerbose 'elseif ($item1.MemberClass -ieq "group") -> true' $users = getUsersByMemberGroup $item1.MemberName foreach ($u in $users) { - outLogVerbose 'foreach $u in $users:' $u.MemberName + ### outLogVerbose 'foreach $u in $users:' $u.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $u.MemberName + ";" + "" + ";" + "" + ";" + "group" + ";" + $item.OldName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) } @@ -1120,10 +1120,10 @@ function ProcessADObjects } elseif ($roletypeTag -ieq $FI.TypeTagAppConfiguration) { - outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagAppConfiguration) -> true' + ### outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagAppConfiguration) -> true' foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.ObjectName + outLog ('[$roletypeTag -ieq $FI.TypeTagAppConfiguration] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.ObjectName) $DisplayName = $adObjectEntry.ShortCut + $adObjectEntry.ObjectName.Substring($adObjectEntry.ObjectName.IndexOf('-') + 1) @@ -1135,33 +1135,33 @@ function ProcessADObjects if ($NewFullName.Contains("IntExK")) { - outLogVerbose 'if ($NewFullName.Contains("IntExK")) -> true' + ### outLogVerbose 'if ($NewFullName.Contains("IntExK")) -> true' continue } if ($DisplayName -eq "AK_WEB_SSKMG-STD") { - outLogVerbose 'if ($DisplayName -eq "AK_WEB_SSKMG-STD") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_WEB_SSKMG-STD") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_SSKMG-STD" } if ($DisplayName -eq "AK_IEK_Admins") { - outLogVerbose 'if ($DisplayName -eq "AK_IEK_Admins") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_IEK_Admins") -> true' $NewFullName = $Institut + "GGX-AKE_IntExK_Admins" } if ($DisplayName -eq "AK_OFK_Office_Default") { - outLogVerbose 'if ($DisplayName -eq "AK_OFK_Office_Default") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_OFK_Office_Default") -> true' $NewFullName = $Institut + "GGX-AKO_OFFK_Office_Default" } if ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") { - outLogVerbose 'if ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_IE_ALT_Videoueberwachung" } if ($DisplayName -eq "AK_WEB_OhneIntranet") { - outLogVerbose 'if ($DisplayName -eq "AK_WEB_OhneIntranet") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_WEB_OhneIntranet") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_OhneIntranet" } @@ -1182,7 +1182,7 @@ function ProcessADObjects foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.ObjectName + outLog ('[$roletypeTag -ieq $FI.TypeTagAppConfiguration] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.ObjectName) $DisplayName = $adObjectEntry.ShortCut + $adObjectEntry.ObjectName.Substring($adObjectEntry.ObjectName.IndexOf('-') + 1) $TempString = $adObjectEntry.ObjectName.Split('-') $adObjectEntry.GroupName = $TempString[0] + '-' + $DisplayName @@ -1191,37 +1191,37 @@ function ProcessADObjects $NewFullName = $Institut + $DisplayName if ($DisplayName -eq "AK_WEB_SSKMG-STD") { - outLogVerbose 'if ($DisplayName -eq "AK_WEB_SSKMG-STD") -> true' + ### outLogVerbose 'if ($DisplayName -eq "AK_WEB_SSKMG-STD") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_SSKMG-STD" $MPNR = 500000001 } elseif ($DisplayName -eq "AK_IEK_Admins") { - outLogVerbose 'elseif ($DisplayName -eq "AK_IEK_Admins") -> true' + ### outLogVerbose 'elseif ($DisplayName -eq "AK_IEK_Admins") -> true' $NewFullName = $Institut + "GGX-AKE_IntExK_Admins" $MPNR = 500000002 } elseif ($DisplayName -eq "AK_OFK_Office_Default") { - outLogVerbose 'elseif ($DisplayName -eq "AK_OFK_Office_Default") -> true' + ### outLogVerbose 'elseif ($DisplayName -eq "AK_OFK_Office_Default") -> true' $NewFullName = $Institut + "GGX-AKO_OFFK_Office_Default" $MPNR = 500000003 } elseif ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") { - outLogVerbose 'elseif ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") -> true' + ### outLogVerbose 'elseif ($DisplayName -eq "AK_WEB_IE_ALT_Videoueberwachung") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_IE_ALT_Videoueberwachung" $MPNR = 500000004 } elseif ($DisplayName -eq "AK_WEB_OhneIntranet") { - outLogVerbose 'elseif ($DisplayName -eq "AK_WEB_OhneIntranet") -> true' + ### outLogVerbose 'elseif ($DisplayName -eq "AK_WEB_OhneIntranet") -> true' $NewFullName = $Institut + "GGX-AKW_WEB_OhneIntranet" $MPNR = 500000005 } else { - outLogVerbose 'else -> true (if/elseif ($DisplayName -eq "AK_WEB_OhneIntranet") -> false)' + ### outLogVerbose 'else -> true (if/elseif ($DisplayName -eq "AK_WEB_OhneIntranet") -> false)' $NewFullName = $DisplayName $MPNR = $DUMPNR } @@ -1245,7 +1245,7 @@ function ProcessADObjects foreach ($userMemberShip in $userMemberShips) { - outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName + ### outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $NewFullName + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) @@ -1255,14 +1255,14 @@ function ProcessADObjects if ($userMemberShip.Origin -ieq "user") { - outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' + ### outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' try { $persnr = $mitarbeiter_array.Item($userMemberShip.MemberName) $dum = $mitarbeiter_array.Item($userMemberShip.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $userMemberShip.MemberName } $persnr = $dum @@ -1282,13 +1282,13 @@ function ProcessADObjects } elseif ($roletypeTag -ieq $FI.TypeTagOrganisation) { - outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagOrganisation) -> true' + ### outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagOrganisation) -> true' $i = 1 $ProfilNummer = 1 $ProfilNR = 440000000 foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.ObjectName + outLog ('[$roletypeTag -ieq $FI.TypeTagOrganisation] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.ObjectName) $DisplayName = $adObjectEntry.ShortCut + $adObjectEntry.ObjectName.Substring($adObjectEntry.ObjectName.IndexOf('-') + 1) $TempString = $adObjectEntry.ObjectName.Split('-') @@ -1318,7 +1318,7 @@ function ProcessADObjects $userMemberShips = @(getAllUserMemberships $adObjectEntry) foreach ($userMemberShip in $userMemberShips) { - outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName + ### outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) @@ -1327,14 +1327,14 @@ function ProcessADObjects if ($userMemberShip.Origin -ieq "user") { - outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' + ### outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' try { $persnr = $mitarbeiter_array.Item($userMemberShip.MemberName) $dum = $mitarbeiter_array.Item($userMemberShip.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $userMemberShip.MemberName } $persnr = $dum @@ -1355,25 +1355,25 @@ function ProcessADObjects elseif ($roletypeTag -ieq $FI.TypeTagSecurity) { - outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagSecurity) -> true' + ### outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagSecurity) -> true' $SicherheitseinstellungenFilePath = $SecurityInFilePath $SicherheitseinstellungenFilePathEntries = Get-Content -Path $SicherheitseinstellungenFilePath | ConvertFrom-Csv -Delimiter ";" $sec_array = @{"nummer" = "nummer"} foreach ($item in $SicherheitseinstellungenFilePathEntries) { - outLogVerbose 'foreach $item in $SicherheitseinstellungenFilePathEntries:' $item.Name + outLog ('[$roletypeTag -ieq $FI.TypeTagSecurity] foreach $item in $SicherheitseinstellungenFilePathEntries: ' + $item.Name) $sec_array[$item.Name] = $item.Verantwortlicher } foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.OldName + outLog ('[$roletypeTag -ieq $FI.TypeTagSecurity] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.OldName) $adObjectEntry.OldName = $adObjectEntry.ObjectName if ( $adObjectEntry.OldName.Contains($SPKID + "GDT")) { - outLogVerbose 'if ($adObjectEntry.OldName.Contains($SPKID + "GDT")) -> true' + ### outLogVerbose 'if ($adObjectEntry.OldName.Contains($SPKID + "GDT")) -> true' continue } @@ -1395,7 +1395,7 @@ function ProcessADObjects $pnRules = [System.Collections.Generic.List[object]]::new() foreach ($row in (Import-Csv -Path $KURSProfileNumberMapping -Delimiter ";")) { - outLogVerbose 'foreach $row in (Import-Csv -Path $KURSProfileNumberMapping -Delimiter ";"):' $row + outLog ('[$roletypeTag -ieq $FI.TypeTagSecurity] foreach $row in (Import-Csv -Path $KURSProfileNumberMapping -Delimiter ";"): ' + $row) $pnRules.Add([pscustomobject]@{ Pattern = $row.Pattern PN = $pnPrefix1 + $pnPrefix2 + $row.Suffix @@ -1409,12 +1409,12 @@ function ProcessADObjects foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.OldName + outLog ('[$roletypeTag -ieq $FI.TypeTagSecurity] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.OldName) if ( $adObjectEntry.OldName.Contains($SPKID + "GDT")) { - outLogVerbose 'if ($adObjectEntry.OldName.Contains($SPKID + "GDT")) -> true' + ### outLogVerbose 'if ($adObjectEntry.OldName.Contains($SPKID + "GDT")) -> true' continue } @@ -1432,17 +1432,17 @@ function ProcessADObjects $PN = $null foreach ($rule in $pnRules) { - outLogVerbose 'foreach $rule in $pnRules:' $rule + ### outLogVerbose 'foreach $rule in $pnRules:' $rule if ($DisplayName.Contains($rule.Pattern)) { - outLogVerbose 'if ($DisplayName.Contains($rule.Pattern)) -> true' + ### outLogVerbose 'if ($DisplayName.Contains($rule.Pattern)) -> true' $PN = $rule.PN break } } if ($null -eq $PN) { - outLogVerbose 'if ($null -eq $PN) -> true' + ### outLogVerbose 'if ($null -eq $PN) -> true' $PN = ($ProfilNummerSonstigesStartWert + $iSonstiges).ToString() $iSonstiges++ } @@ -1459,7 +1459,7 @@ function ProcessADObjects foreach ($userMemberShip in $userMemberShips) { - outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName + ### outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) @@ -1468,14 +1468,14 @@ function ProcessADObjects if ($userMemberShip.Origin -ieq "user") { - outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' + ### outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' try { $persnr = $mitarbeiter_array.Item($userMemberShip.MemberName) $dum = $mitarbeiter_array.Item($userMemberShip.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $userMemberShip.MemberName } $persnr = $dum @@ -1495,10 +1495,10 @@ function ProcessADObjects elseif ($roletypeTag -ieq $FI.TypeTagRole) { - outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagRole) -> true' + ### outLogVerbose 'elseif ($roletypeTag -ieq $FI.TypeTagRole) -> true' foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.ObjectName + outLog ('[$roletypeTag -ieq $FI.TypeTagRole] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.ObjectName) $DisplayName = $adObjectEntry.ShortCut + $adObjectEntry.ObjectName.Substring($adObjectEntry.ObjectName.IndexOf('-') + 1) $TempString = $adObjectEntry.ObjectName.Split('-') @@ -1521,7 +1521,7 @@ function ProcessADObjects foreach ($adObjectEntry in $adObjectEntries) { - outLogVerbose 'foreach $adObjectEntry in $adObjectEntries:' $adObjectEntry.ObjectName + outLog ('[$roletypeTag -ieq $FI.TypeTagRole] foreach $adObjectEntry in $adObjectEntries: ' + $adObjectEntry.ObjectName) $DisplayName = $adObjectEntry.ShortCut + $adObjectEntry.ObjectName.Substring($adObjectEntry.ObjectName.IndexOf('-') + 1) $TempString = $adObjectEntry.ObjectName.Split('-') $adObjectEntry.GroupName = $TempString[0] + '-' + $DisplayName @@ -1530,20 +1530,20 @@ function ProcessADObjects if (-not ($adObjectEntry.OldName.StartsWith($SPKID + "GUX")) -and -not (testKnownPrefixes $adObjectEntry.OldName $prefixMatcher)) { - outLogVerbose 'if (-not ($adObjectEntry.OldName.StartsWith($SPKID + "GUX")) -and -not (testKnownPrefixes $adObjectEntry.OldName $ ...) -> true' + ### outLogVerbose 'if (-not ($adObjectEntry.OldName.StartsWith($SPKID + "GUX")) -and -not (testKnownPrefixes $adObjectEntry.OldName $ ...) -> true' continue } $roleType = getRoleType $adObjectEntry $roletypeTag if ($NewFullName.Contains("R_LM_")) { - outLogVerbose 'if ($NewFullName.Contains("R_LM_")) -> true' + ### outLogVerbose 'if ($NewFullName.Contains("R_LM_")) -> true' $PN = ($ProfilNummerLM).ToString() $ProfilNummerLM++ $NewFullName = $NewFullName.Replace("AR_LM_","LM_") } else { - outLogVerbose 'else -> true (if/elseif ($NewFullName.Contains("R_LM_")) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($NewFullName.Contains("R_LM_")) -> false)' $PN = ($ProfilNummer + $iSonstiges).ToString() $iSonstiges++ } @@ -1557,10 +1557,10 @@ function ProcessADObjects if(1 -lt 2) { - outLogVerbose 'if (1 -lt 2) -> true' + ### outLogVerbose 'if (1 -lt 2) -> true' foreach ($userMemberShip in $userMemberShips) { - outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName + ### outLogVerbose 'foreach $userMemberShip in $userMemberShips:' $userMemberShip.MemberName $DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName $DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine) @@ -1569,14 +1569,14 @@ function ProcessADObjects if ($userMemberShip.Origin -ieq "user") { - outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' + ### outLogVerbose 'if ($userMemberShip.Origin -ieq "user") -> true' try { $persnr = $mitarbeiter_array.Item($userMemberShip.MemberName) $dum = $mitarbeiter_array.Item($userMemberShip.MemberName) if (-not $dum) { - outLogVerbose 'if (-not $dum) -> true' + ### outLogVerbose 'if (-not $dum) -> true' $dum = $userMemberShip.MemberName } $persnr = $dum @@ -1601,29 +1601,33 @@ function ProcessADObjects $DAWGruppenverwaltungOutList.Sort($ordinalComparer) $KURSSollProfileOutList.Sort($ordinalComparer) $KURSIstMitarbeiterProfileOutList.Sort($ordinalComparer) + removeDuplicatesFromSortedList $DAWGruppenAnlegenOutList "DAWGruppenAnlegenOutList" + removeDuplicatesFromSortedList $DAWGruppenverwaltungOutList "DAWGruppenverwaltungOutList" + removeDuplicatesFromSortedList $KURSSollProfileOutList "KURSSollProfileOutList" + removeDuplicatesFromSortedList $KURSIstMitarbeiterProfileOutList "KURSIstMitarbeiterProfileOutList" $DAWGruppenverwaltungNeuOutList.Clear() $lastLdap = $null foreach ($outLine in $DAWGruppenverwaltungOutList) { - outLogVerbose 'foreach $outLine in $DAWGruppenverwaltungOutList:' $outLine + ### outLogVerbose 'foreach $outLine in $DAWGruppenverwaltungOutList:' $outLine $cols = $outLine.Split(";") if ([string]::IsNullOrEmpty($cols[5])) { - outLogVerbose 'if ([string]::IsNullOrEmpty($cols[5])) -> true' + ### outLogVerbose 'if ([string]::IsNullOrEmpty($cols[5])) -> true' $DAWGruppenverwaltungNeuOutList.Add($outLine) $lastLdap = $null continue } if ($cols[2] -cne $lastLdap) { - outLogVerbose 'if ($cols[2] -cne $lastLdap) -> true' + ### outLogVerbose 'if ($cols[2] -cne $lastLdap) -> true' $DAWGruppenverwaltungNeuOutList.Add($outLine) $lastLdap = $cols[2] } else { - outLogVerbose 'else -> true (if/elseif ($cols[2] -cne $lastLdap) -> false)' + ### outLogVerbose 'else -> true (if/elseif ($cols[2] -cne $lastLdap) -> false)' $DAWGruppenverwaltungNeuOutList.Add(";;;;;" + $cols[5] + ";;;;") } } @@ -1642,7 +1646,3 @@ function ProcessADObjects outLog ("finished: " + $MyInvocation.MyCommand + " on type " + $roletypeTag.PadRight(30, " ") + ", used " + ($end - $begin)) } - $end = Get-Date - outLog "finished: " $MyInvocation.MyCommand " on type " $roletypeTag.PadRight(30, " ") ", used " ($end - $begin) -} - diff --git a/Process-ADObjects-Work.ps1 b/Process-ADObjects-Work.ps1 index 2c6930d..27ae9a5 100644 --- a/Process-ADObjects-Work.ps1 +++ b/Process-ADObjects-Work.ps1 @@ -8,17 +8,17 @@ function prepareADObjectsByType { $counter = 1 $count = $ADObjects.Count foreach ($adObject in $ADObjects) { - outLogVerbose 'foreach $adObject in $ADObjects:' $adObject.ObjectName + outLog ('foreach $adObject in $ADObjects: ' + $adObject.ObjectName) if (-Not ($adObject.Description)) { - outLogVerbose 'if (-Not ($adObject.Description)) -> true' + ### outLogVerbose 'if (-Not ($adObject.Description)) -> true' $adObject.Description = $Config.EmptyDescription } $currentADObject = $null if ($typeTag -ieq $FI.TypeTagAppConfiguration) { - outLogVerbose 'if ($typeTag -ieq $FI.TypeTagAppConfiguration) -> true' + ### outLogVerbose 'if ($typeTag -ieq $FI.TypeTagAppConfiguration) -> true' if ($adObject.OU -cmatch $FI.RelevantGroups.AppConfiguration.Filter) { - outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.AppConfiguration.Filter) -> true' + ### outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.AppConfiguration.Filter) -> true' $userMemberShips = @() $adObjectEntry = @{ObjectName = $adObject.ObjectName; Path = $adObject.OU; ShortCut = $FI.RelevantGroups.AppConfiguration.ShortCut; Description = $adObject.Description; Users = $userMemberShips} $adObjectFileEntry = $adObject.ObjectName + ";" + $adObject.OU + ";" + $FI.RelevantGroups.AppConfiguration.ShortCut + ";" + $adObject.Description @@ -26,15 +26,15 @@ function prepareADObjectsByType { $adGroupObjects += $adObjectEntry $counter++ if ($IsTestMode -and ($counter -gt $Config.TestMode) ) { - outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' + ### outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' break } } } elseif ($typeTag -ieq $FI.TypeTagAppAccess) { - outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagAppAccess) -> true' + ### outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagAppAccess) -> true' if ($adObject.OU -cmatch $FI.RelevantGroups.AppAccess.Filter) { - outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.AppAccess.Filter) -> true' + ### outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.AppAccess.Filter) -> true' $userMemberShips = @() $adObjectEntry = @{ObjectName = $adObject.ObjectName; Path = $adObject.OU; ShortCut = $FI.RelevantGroups.AppAccess.ShortCut; Description = $adObject.Description; Users = $userMemberShips} $adObjectFileEntry = $adObject.ObjectName + ";" + $adObject.OU + ";" + $FI.RelevantGroups.AppAccess.ShortCut + ";" + $adObject.Description @@ -42,15 +42,15 @@ function prepareADObjectsByType { $adGroupObjects += $adObjectEntry $counter++ if ($IsTestMode -and ($counter -gt $Config.TestMode) ) { - outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' + ### outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' break } } } elseif ($typeTag -ieq $FI.TypeTagFileSystemAccess) { - outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagFileSystemAccess) -> true' + ### outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagFileSystemAccess) -> true' if ($adObject.OU -cmatch $FI.RelevantGroups.FilesystemAccess.Filter) { - outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.FilesystemAccess.Filter) -> true' + ### outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.FilesystemAccess.Filter) -> true' $userMemberShips = @() $adObjectEntry = @{ObjectName = $adObject.ObjectName; Path = $adObject.OU; ShortCut = $FI.RelevantGroups.FilesystemAccess.ShortCut; Description = $adObject.Description; Users = $userMemberShips} $adObjectFileEntry = $adObject.ObjectName + ";" + $adObject.OU + ";" + $FI.RelevantGroups.FilesystemAccess.ShortCut + ";" + $adObject.Description @@ -58,15 +58,15 @@ function prepareADObjectsByType { $adGroupObjects += $adObjectEntry $counter++ if ($IsTestMode -and ($counter -gt $Config.TestMode) ) { - outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' + ### outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' break } } } elseif ($typeTag -ieq $FI.TypeTagOrganisation) { - outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagOrganisation) -> true' + ### outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagOrganisation) -> true' if ($adObject.OU -cmatch $FI.RelevantGroups.Organisation.Filter) { - outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.Organisation.Filter) -> true' + ### outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.Organisation.Filter) -> true' $userMemberShips = @() $adObjectEntry = @{ObjectName = $adObject.ObjectName; Path = $adObject.OU; ShortCut = $FI.RelevantGroups.Organisation.ShortCut; Description = $adObject.Description; Users = $userMemberShips} $adObjectFileEntry = $adObject.ObjectName + ";" + $adObject.OU + ";" + $FI.RelevantGroups.Organisation.ShortCut + ";" + $adObject.Description @@ -74,15 +74,15 @@ function prepareADObjectsByType { $adGroupObjects += $adObjectEntry $counter++ if ($IsTestMode -and ($counter -gt $Config.TestMode) ) { - outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' + ### outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' break } } } elseif ($typeTag -ieq $FI.TypeTagSecurity) { - outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagSecurity) -> true' + ### outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagSecurity) -> true' if ($adObject.OU -cmatch $FI.RelevantGroups.Security.Filter) { - outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.Security.Filter) -> true' + ### outLogVerbose 'if ($adObject.OU -cmatch $FI.RelevantGroups.Security.Filter) -> true' $userMemberShips = @() $adObjectEntry = @{ObjectName = $adObject.ObjectName; Path = $adObject.OU; ShortCut = $FI.RelevantGroups.Security.ShortCut; Description = $adObject.Description; Users = $userMemberShips} $adObjectFileEntry = $adObject.ObjectName + ";" + $adObject.OU + ";" + $FI.RelevantGroups.Security.ShortCut + ";" + $adObject.Description @@ -90,16 +90,16 @@ function prepareADObjectsByType { $adGroupObjects += $adObjectEntry $counter++ if ($IsTestMode -and ($counter -gt $Config.TestMode) ) { - outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' + ### outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' break } } } elseif ($typeTag -ieq $FI.TypeTagRole) { - outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagRole) -> true' + ### outLogVerbose 'elseif ($typeTag -ieq $FI.TypeTagRole) -> true' if ($adObject.OU -like "*Anwenderrollen*") { - outLogVerbose 'if ($adObject.OU -like "*Anwenderrollen*") -> true' + ### outLogVerbose 'if ($adObject.OU -like "*Anwenderrollen*") -> true' $userMemberShips = @() $adObjectEntry = @{ObjectName = $adObject.ObjectName; Path = $adObject.OU; ShortCut = $FI.RelevantGroups.Role.ShortCut; Description = $adObject.Description; Users = $userMemberShips} $adObjectFileEntry = $adObject.ObjectName + ";" + $adObject.OU + ";" + $FI.RelevantGroups.Role.ShortCut + ";" + $adObject.Description @@ -109,7 +109,7 @@ function prepareADObjectsByType { if ($IsTestMode -and ($counter -gt $Config.TestMode) ) { - outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' + ### outLogVerbose 'if ($IsTestMode -and ($counter -gt $Config.TestMode)) -> true' break } } diff --git a/Process-ADObjects.ps1 b/Process-ADObjects.ps1 old mode 100755 new mode 100644