This commit is contained in:
Edmond Gebara 2026-07-05 15:21:34 +02:00
parent 87f047f909
commit e7076027f5
2 changed files with 43 additions and 245 deletions

2
.gitignore vendored
View file

@ -3,4 +3,6 @@ Data/*/Out/*
!Data/Out/*/.gitkeep
Data/*/Tmp/*
!Data/Tmp/*/.gitkeep
Data/*/Log/*
!Data/Log/*/.gitkeep
Data/*/Cmp/*

View file

@ -475,11 +475,6 @@ function ProcessADObjects
# $Institut + ";" + $roleType + ";" + $item.OldName + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungOutLine = $Institut + ";" + $roleType + ";" + $item.OldName + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + ""
$DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine)
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + $roleType + ";" + $item.OldName + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + ""
# BUGFIX 2026-07-05: was $DAWGruppenverwaltungOutList.Add(...) - the Neu line went
# into the OUT list, duplicating every FileSystemAccess creation row in the Out file
# (2x each) and omitting it from the Neu file.
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$NewFullName = $item.'GUIADGroup.Name'
$ProfilNummer = 0
@ -895,8 +890,6 @@ function ProcessADObjects
$KURSSollProfileOutLine = ($ProfilNummer).ToString() + ";" + $NewFullName.Replace($SPKID + "GGX-", "").Replace("_1552_", "_AD_") + ";" + $ProfilName.Replace("-AZ_", "-AV_") + ";" + $dum + ";" + $item.OldName + ";" + "Verzeichnispfad: " + $FullPath + ";" + $VerzeichnisArt
$KURSSollProfileOutList.Add($KURSSollProfileOutLine)
$allUsers = ""
$cntUsers = [int]0
foreach ($item1 in $ADObjectMemberships)
{
@ -909,25 +902,6 @@ function ProcessADObjects
$DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $item1.MemberName + ";" + "" + ";" + "" + ";" + "user" + ";" + ""
$DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine)
$cntUsers++
#Write-Host $cntUsers
if ($cntUsers -lt 2)
{
$allUsers += $SPK.'RootDomainName' + "\" + $item1.MemberName
}
else
{
$allUsers += "`n" + $SPK.'RootDomainName' + "\" + $item1.MemberName
}
if ($cntUsers -gt 13)
{
#Write-Host "Schreibe 1"
# $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $item1.MemberName + ";" + "" + ";" + "" + ";" + "user" + ";" + ""
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
# Kurs Daten schreiben
#Write-Host $u.MemberName $mitarbeiter_array.Item($u.MemberName)
@ -960,42 +934,10 @@ function ProcessADObjects
# $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $u.MemberName + ";" + "" + ";" + "" + ";" + "group" + ";" + $item1.MemberName | Out-File $DAWGruppenverwaltungOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $u.MemberName + ";" + "" + ";" + "" + ";" + "group" + ";" + $item1.MemberName
$DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine)
$cntUsers++
#Write-Host $cntUsers
if ($cntUsers -lt 2)
{
$allUsers += $SPK.'RootDomainName' + "\" + $u.MemberName
}
else
{
$allUsers += "`n" + $SPK.'RootDomainName' + "\" + $u.MemberName
}
if ($cntUsers -gt 13)
{
#Write-Host "Schreibe 2"
# $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
}
}
}
}
#Neu Anfang
#Write-Host "Anzahl User: " $cntUsers
if ($cntUsers -ge 1)
{
#Write-Host "Schreibe 3"
# $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("-SE_", "-VSE_") + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
#Neu Ende
$i++
}
@ -1139,8 +1081,6 @@ function ProcessADObjects
# $Institut + ";" + $roleType + ";" + $item.OldName + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungOutLine = $Institut + ";" + $roleType + ";" + $item.OldName + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + ""
$DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine)
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + $roleType + ";" + $item.OldName + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + ""
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$ProfilNummer = ""
@ -1173,7 +1113,6 @@ function ProcessADObjects
$dum = "0570000/0012"
}
### Neu Anfang
if ( $pkey_array.ContainsKey("PAZ_" + $AWNR))
{
$pkey_array.Item("PAZ_" + $AWNR)++
@ -1186,7 +1125,6 @@ function ProcessADObjects
}
#$PnrStr = ([string]$pkey_array.Item("PAZ_" + $AWNR)).PadLeft(3, '0')
### Neu Ende
#"50" + $AWNR + "9" + ($PnrStr).ToString() + ";" + $item.'GUIADGroup.Name' + ";" + $ProfilName + ";" + $dum + ";" + "" | out-file $KURSSollProfileOutFilePath -Encoding "utf8NoBom" -Append
if ($AWNR -ieq "0000")
@ -1257,7 +1195,6 @@ function ProcessADObjects
$kz = "XXXXX"
}
### Neu Anfang
if ( $pkey_array.ContainsKey("PAZ_" + $AWNR))
{
$pkey_array.Item("PAZ_" + $AWNR)++
@ -1271,7 +1208,6 @@ function ProcessADObjects
}
$PnrStr = ([string]$pkey_array.Item("PAZ_" + $AWNR)).PadLeft(3, '0')
### Neu Ende
#"50" + $AWNR + "9" + ($PnrStr).ToString() + ";" + $item.'GUIADGroup.Name' + ";" + $ProfilName + ";" + $dum + ";" + "" | out-file $KURSSollProfileOutFilePath -Encoding "utf8NoBom" -Append
##$NNNAME = $kz + "-" + $aname
@ -1299,8 +1235,6 @@ function ProcessADObjects
}
# foreach ($userMemberShip in $userMemberShips) {
$allUsers = ""
$cntUsers = [int]0
foreach ($item1 in $ADObjectMemberships)
{
@ -1317,25 +1251,6 @@ function ProcessADObjects
$DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $item1.MemberName + ";" + "" + ";" + "" + ";" + "user" + ";" + $item.OldName
$DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine)
$cntUsers++
#Write-Host $cntUsers
if ($cntUsers -lt 2)
{
$allUsers += $SPK.'RootDomainName' + "\" + $item1.MemberName
}
else
{
$allUsers += "`n" + $SPK.'RootDomainName' + "\" + $item1.MemberName
}
if ($cntUsers -gt 13)
{
#Write-Host "Schreibe 1"
# $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
# Kurs Daten schreiben
$dum = $mitarbeiter_array.Item($item1.MemberName)
@ -1360,41 +1275,10 @@ function ProcessADObjects
# $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $u.MemberName + ";" + "" + ";" + "" + ";" + "group" + ";" + $item.OldName | Out-File $DAWGruppenverwaltungOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $u.MemberName + ";" + "" + ";" + "" + ";" + "group" + ";" + $item.OldName
$DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine)
$cntUsers++
#Write-Host $cntUsers
if ($cntUsers -lt 2)
{
$allUsers += $SPK.'RootDomainName' + "\" + $u.MemberName
}
else
{
$allUsers += "`n" + $SPK.'RootDomainName' + "\" + $u.MemberName
}
if ($cntUsers -gt 13)
{
#Write-Host "Schreibe 2"
# $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
}
}
}
}
#Neu Anfang
#Write-Host "Anzahl User: " $cntUsers
if ($cntUsers -ge 1)
{
#Write-Host "Schreibe 3"
# $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $item.'GUIADGroup.Name'.Replace("Serviceportal", "SVP").Replace("Anforderungsmanagementberichte", "Anforderungsmgtberichte") + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
#Neu Ende
$i++
}
@ -1518,11 +1402,7 @@ function ProcessADObjects
# $Institut + ";" + $roleType + ";" + $adObjectEntry.OldName + ";" + $NewFullName + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungOutLine = $Institut + ";" + $roleType + ";" + $adObjectEntry.OldName + ";" + $NewFullName + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + ""
$DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine)
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + $roleType + ";" + $adObjectEntry.OldName + ";" + $NewFullName + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + ""
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$userMemberShips = @(getAllUserMemberships $adObjectEntry)
$allUsers = ""
$cntUsers = [int]0
$NewFullName1 = $NewFullName
#$StelleVerant = "9999999/9999"
@ -1552,25 +1432,6 @@ function ProcessADObjects
#$Institut + ";" + "Role" + ";" + $NewFullName + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $NewFullName + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine)
$cntUsers++
#Write-Host "cnt: " $cntUsers
if ($cntUsers -lt 2)
{
$allUsers += $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName
}
else
{
$allUsers += "`n" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName
}
if ($cntUsers -gt 13)
{
# $Institut + ";" + "Role" + ";" + $NewFullName + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $NewFullName + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
#Write-Host "## o: " $userMemberShip.Origin
@ -1604,16 +1465,6 @@ function ProcessADObjects
}
}
#Neu Anfang
if ($cntUsers -ge 1)
{
# $Institut + ";" + "Role" + ";" + $NewFullName + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $NewFullName + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
#Neu Ende
$i++
}
}
@ -1660,8 +1511,6 @@ function ProcessADObjects
$DAWGruppenverwaltungOutLine = $Institut + ";" + $roleType + ";" + $adObjectEntry.OldName + ";" + $NewFullName1 + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + ""
$DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine)
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + $roleType + ";" + $adObjectEntry.OldName + ";" + $NewFullName1 + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + ""
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$PnrStr = ([string]$ProfilNummer).PadLeft(2, '0')
# $AWNR = ([string]$nummer_array.Item($item.OldName)).PadLeft(3, '0')
@ -1674,8 +1523,6 @@ function ProcessADObjects
$KURSSollProfileOutList.Add($KURSSollProfileOutLine)
$ProfilNummer++
$userMemberShips = @(getAllUserMemberships $adObjectEntry)
$allUsers = ""
$cntUsers = [int]0
foreach ($userMemberShip in $userMemberShips)
{
# Fehler laut Norbert
@ -1685,24 +1532,6 @@ function ProcessADObjects
#Write-Host "TypeTagOrganisation: " $userMemberShip.MemberClass
#$Institut + ";" + "Role" + ";" + $NewFullName + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | out-file $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
#Write-Host "TypeTagOrganisation: " $userMemberShip.MemberClass
$cntUsers++
#Write-Host $cntUsers
if ($cntUsers -lt 2)
{
$allUsers += $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName
}
else
{
$allUsers += "`n" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName
}
if ($cntUsers -gt 13)
{
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
#$userMemberShip | Out-String
@ -1733,15 +1562,6 @@ function ProcessADObjects
}
$i++
#Neu Anfang
if ($cntUsers -ge 1)
{
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
#Neu Ende
}
}
@ -1809,8 +1629,6 @@ function ProcessADObjects
$ProfilNummerSonstigesStartWert = 430000000
$PN = ""
$StelleVerant = "0570000/0012"
$allUsers = ""
$cntUsers = [int]0
foreach ($adObjectEntry in $adObjectEntries)
{
@ -1836,8 +1654,6 @@ function ProcessADObjects
# $Institut + ";" + $roleType + ";" + $adObjectEntry.OldName + ";" + $NewFullName.Replace("-S_", "-SE_") + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungOutLine = $Institut + ";" + $roleType + ";" + $adObjectEntry.OldName + ";" + $NewFullName.Replace("-S_", "-SE_") + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + ""
$DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine)
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + $roleType + ";" + $adObjectEntry.OldName + ";" + $NewFullName.Replace("-S_", "-SE_") + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + "" + ";" + ""
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$PN = $null
foreach ($rule in $pnRules)
@ -1872,25 +1688,6 @@ function ProcessADObjects
$DAWGruppenverwaltungOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ";" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName + ";" + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungOutList.Add($DAWGruppenverwaltungOutLine)
$cntUsers++
#Write-Host $cntUsers
if ($cntUsers -lt 2)
{
$allUsers += $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName
}
else
{
$allUsers += "`n" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName
}
if ($cntUsers -gt 13)
{
# $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
$persnr = "0000000000"
@ -1918,16 +1715,6 @@ function ProcessADObjects
$KURSIstMitarbeiterProfileOutList.Add($KURSIstMitarbeiterProfileOutLine)
}
}
#Neu Anfang
if ($cntUsers -ge 1)
{
# $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
#Neu Ende
}
}
@ -1961,8 +1748,6 @@ function ProcessADObjects
$iSonstiges = 0
$PN = ""
$StelleVerant = "0570000/0012"
$allUsers = ""
$cntUsers = [int]0
foreach ($adObjectEntry in $adObjectEntries)
{
@ -2024,25 +1809,6 @@ function ProcessADObjects
#Write-Host "TypeTagSecurity: " $userMemberShip.MemberClass
#$userMemberShip | Out-String
$cntUsers++
#Write-Host $cntUsers
if ($cntUsers -lt 2)
{
$allUsers += $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName
}
else
{
$allUsers += "`n" + $SPK.'RootDomainName' + "\" + $userMemberShip.MemberName
}
if ($cntUsers -gt 13)
{
# $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
$persnr = "0000000000"
@ -2071,20 +1837,51 @@ function ProcessADObjects
}
}
}
#Neu Anfang
if ($cntUsers -ge 1)
{
# $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutLine = $Institut + ";" + "Role" + ";" + $NewFullName1 + ";" + "" + ";" + "" + ';"' + $allUsers + '";' + "" + ";" + "" + ";" + $userMemberShip.Origin + ";" + $userMemberShip.OriginName
$DAWGruppenverwaltungNeuOutList.Add($DAWGruppenverwaltungNeuOutLine)
$allUsers = ""
$cntUsers = 0
}
#Neu Ende
}
}
# ===== Post-processing of output collections (2026-07-05) =====================
# 1) All collections are sorted ONCE before writing (deterministic, culture-
# independent ordinal order). Inline writes stay unsorted and cheap.
# 2) The 'Neu' Gruppenverwaltung variant is no longer produced along the way;
# it is DERIVED from the sorted Out list: rows assigning an account to a
# target group (Accounts.Add non-empty) are grouped by GUIADGroup.LDAP.
# The first row of each group keeps all columns; subsequent rows carry only
# the Accounts.Add column. Rows without an account assignment (e.g. group
# creation rows) pass through unchanged.
$ordinalComparer = [System.StringComparer]::Ordinal
$DAWGruppenAnlegenOutList.Sort($ordinalComparer)
$DAWGruppenverwaltungOutList.Sort($ordinalComparer)
$KURSSollProfileOutList.Sort($ordinalComparer)
$KURSIstMitarbeiterProfileOutList.Sort($ordinalComparer)
$DAWGruppenverwaltungNeuOutList.Clear()
$lastLdap = $null
foreach ($outLine in $DAWGruppenverwaltungOutList)
{
$cols = $outLine.Split(";")
if ([string]::IsNullOrEmpty($cols[5]))
{
# no account assignment -> pass through unchanged
$DAWGruppenverwaltungNeuOutList.Add($outLine)
$lastLdap = $null
continue
}
if ($cols[2] -cne $lastLdap)
{
# first row of a GUIADGroup.LDAP block -> all columns
$DAWGruppenverwaltungNeuOutList.Add($outLine)
$lastLdap = $cols[2]
}
else
{
# subsequent row of the same block -> only GUIADGroup.Accounts.Add.LDAPs
$DAWGruppenverwaltungNeuOutList.Add(";;;;;" + $cols[5] + ";;;;")
}
}
$DAWGruppenAnlegenOutList | Out-File $DAWGruppenAnlegenOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungOutList | Out-File $DAWGruppenverwaltungOutFilePath -Encoding "utf8NoBom" -Append
$DAWGruppenverwaltungNeuOutList | Out-File $DAWGruppenverwaltungNeuOutFilePath -Encoding "utf8NoBom" -Append
@ -2098,4 +1895,3 @@ function ProcessADObjects
$end = Get-Date
outLog "finished: " $MyInvocation.MyCommand " on type " $roletypeTag.PadRight(30, " ") ", used " ($end - $begin)
}