From 7427932adebbac1ee6161da11bea9edac30d41ef Mon Sep 17 00:00:00 2001 From: Friedrich Weinmann Date: Wed, 27 Sep 2023 11:26:47 +0200 Subject: [PATCH] 1.8.199 --- DomainManagement/DomainManagement.psd1 | 2 +- DomainManagement/changelog.md | 4 ++++ .../functions/domainlevel/Test-DMDomainLevel.ps1 | 4 +++- DomainManagement/functions/groups/Register-DMGroup.ps1 | 2 +- DomainManagement/functions/groups/Test-DMGroup.ps1 | 9 +++++++-- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/DomainManagement/DomainManagement.psd1 b/DomainManagement/DomainManagement.psd1 index 65eeac1..c4cf1b0 100644 --- a/DomainManagement/DomainManagement.psd1 +++ b/DomainManagement/DomainManagement.psd1 @@ -3,7 +3,7 @@ RootModule = 'DomainManagement.psm1' # Version number of this module. - ModuleVersion = '1.8.198' + ModuleVersion = '1.8.199' # ID used to uniquely identify this module GUID = '0a405382-ebc2-445b-8325-541535810193' diff --git a/DomainManagement/changelog.md b/DomainManagement/changelog.md index 475468f..7685c74 100644 --- a/DomainManagement/changelog.md +++ b/DomainManagement/changelog.md @@ -1,5 +1,9 @@ # Changelog +## 1.8.199 (2023-09-27) + +- Fix: Groups - When renaming a group from a previous name, it will not find other updates to apply + ## 1.8.198 (2023-05-15) - Upd: Acl - Will no longer try to enable inheritance for objects protected under the AdminSDHolder diff --git a/DomainManagement/functions/domainlevel/Test-DMDomainLevel.ps1 b/DomainManagement/functions/domainlevel/Test-DMDomainLevel.ps1 index 9af9088..2e3b491 100644 --- a/DomainManagement/functions/domainlevel/Test-DMDomainLevel.ps1 +++ b/DomainManagement/functions/domainlevel/Test-DMDomainLevel.ps1 @@ -52,7 +52,9 @@ if ($domain.DomainMode -lt $desiredLevel) { New-TestResult -ObjectType DomainLevel -Type Raise -Identity $domain -Server $Server -Configuration ([pscustomobject]$tempConfiguration) -ADObject $domain -Changed ( - New-AdcChange -Property DomainLevel -OldValue $domain.DomainMode -NewValue $tempConfiguration['DesiredLevel'] -Identity $domain -Type DomainLevel + New-AdcChange -Property DomainLevel -OldValue $domain.DomainMode -NewValue $tempConfiguration['DesiredLevel'] -Identity $domain -Type DomainLevel -ToString { + { '{0}: {1} -> {2}' -f $this.Identity, $this.Old, $this.New } + } ) } } diff --git a/DomainManagement/functions/groups/Register-DMGroup.ps1 b/DomainManagement/functions/groups/Register-DMGroup.ps1 index 390929d..2a6b063 100644 --- a/DomainManagement/functions/groups/Register-DMGroup.ps1 +++ b/DomainManagement/functions/groups/Register-DMGroup.ps1 @@ -25,7 +25,7 @@ .PARAMETER Scope The scope of the group. - Use DomainLocal for groups that grrant direct permissions and Global for role groups. + Use DomainLocal for groups that grant direct permissions and Global for role groups. .PARAMETER Category Whether the group should be a security group or a distribution group. diff --git a/DomainManagement/functions/groups/Test-DMGroup.ps1 b/DomainManagement/functions/groups/Test-DMGroup.ps1 index 55a0d97..9d49e9e 100644 --- a/DomainManagement/functions/groups/Test-DMGroup.ps1 +++ b/DomainManagement/functions/groups/Test-DMGroup.ps1 @@ -58,6 +58,8 @@ #endregion Group that needs to be removed #region Groups that don't exist but should | Groups that need to be renamed + # Flag to avoid duplicate renames in case of OldNames + $noNameUpdate = $false try { $adObject = Get-ADGroup @parameters -Identity $resolvedName -Properties Description -ErrorAction Stop } catch { $oldGroups = foreach ($oldName in ($groupDefinition.OldNames | Resolve-String)) { @@ -79,7 +81,8 @@ 1 { New-TestResult @resultDefaults -Type Rename -ADObject $oldGroups -Changed (New-AdcChange -Identity $adObject -Property Name -OldValue $oldGroups.Name -NewValue $resolvedName) $oldNamesFound += $oldGroups.Name - continue main + $noNameUpdate = $true + $adObject = $oldGroups } #endregion Case: One old version present @@ -108,7 +111,9 @@ Compare-Property @compare -Property Description -Resolve Compare-Property @compare -Property Category -ADProperty GroupCategory Compare-Property @compare -Property Scope -ADProperty GroupScope - Compare-Property @compare -Property Name -Resolve + if (-not $noNameUpdate) { + Compare-Property @compare -Property Name -Resolve + } $ouPath = ($adObject.DistinguishedName -split ",", 2)[1] if ($ouPath -ne (Resolve-String -Text $groupDefinition.Path)) { $null = $changes.Add((New-Change -Property Path -OldValue $ouPath -NewValue (Resolve-String -Text $groupDefinition.Path) -Identity $adObject -Type Group))