From b812126f09527fcef6d4f97a7448042ef1499ae6 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Thu, 29 Jan 2026 12:42:20 +0100 Subject: [PATCH] Fixes an issue with user updates on domain controllers in case the domain is included in the update --- doc/100-General/10-Changelog.md | 6 ++++++ lib/core/windows/New-IcingaWindowsUser.psm1 | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/100-General/10-Changelog.md b/doc/100-General/10-Changelog.md index 4094ae5..3e36190 100644 --- a/doc/100-General/10-Changelog.md +++ b/doc/100-General/10-Changelog.md @@ -7,6 +7,12 @@ documentation before upgrading to a new release. Released closed milestones can be found on [GitHub](https://github.com/Icinga/icinga-powershell-framework/milestones?state=closed). +## 1.12.5 (2026-02-02) + +### Bugfixes + +* [#851](https://github.com/Icinga/icinga-powershell-framework/pull/851) Fixes an issue with user updates on domain controllers, which included the domain besides the user name, causing the user updates to fail + ## 1.12.4 (2026-01-29) ### Security diff --git a/lib/core/windows/New-IcingaWindowsUser.psm1 b/lib/core/windows/New-IcingaWindowsUser.psm1 index 0132df3..86d6e44 100644 --- a/lib/core/windows/New-IcingaWindowsUser.psm1 +++ b/lib/core/windows/New-IcingaWindowsUser.psm1 @@ -38,7 +38,7 @@ function New-IcingaWindowsUser() [bool]$Success = $FALSE; while ($Attempts -lt 10) { - $Result = Start-IcingaProcess -Executable 'net' -Arguments ([string]::Format('user "{0}" "{1}"', $IcingaUser, (ConvertFrom-IcingaSecureString -SecureString (New-IcingaWindowsUserPassword)))); + $Result = Start-IcingaProcess -Executable 'net' -Arguments ([string]::Format('user "{0}" "{1}"', $IcingaUserInfo.User, (ConvertFrom-IcingaSecureString -SecureString (New-IcingaWindowsUserPassword)))); if ($Result.ExitCode -eq 0) { $Success = $TRUE; @@ -49,7 +49,7 @@ function New-IcingaWindowsUser() } if ($Success -eq $FALSE) { - Write-IcingaConsoleError 'Failed to update password for user "{0}": {1}' -Objects $IcingaUser, $Result.Error; + Write-IcingaConsoleError 'Failed to update password for user "{0}": {1}' -Objects $IcingaUserInfo.User, $Result.Error; return @{ 'User' = $UserConfig.Caption; @@ -58,7 +58,7 @@ function New-IcingaWindowsUser() } Write-IcingaConsoleNotice 'User updated successfully.'; } else { - Write-IcingaConsoleWarning 'User "{0}" is not managed by Icinga for Windows. No changes were made.' -Objects $IcingaUser; + Write-IcingaConsoleWarning 'User "{0}" is not managed by Icinga for Windows. No changes were made.' -Objects $IcingaUserInfo.User; } return @{ @@ -69,7 +69,7 @@ function New-IcingaWindowsUser() # Access our local Account Database $AccountDB = [ADSI]"WinNT://$Env:COMPUTERNAME,Computer"; - $IcingaUserObject = $AccountDB.Create("User", $IcingaUser); + $IcingaUserObject = $AccountDB.Create("User", $IcingaUserInfo.User); $IcingaUserObject.SetPassword((ConvertFrom-IcingaSecureString -SecureString (New-IcingaWindowsUserPassword))); $IcingaUserObject.SetInfo(); $IcingaUserObject.FullName = $UserMetadata.FullName;