Fixes an issue with user updates on domain controllers in case the domain is included in the update

This commit is contained in:
Lord Hepipud 2026-01-29 12:42:20 +01:00
parent 7698921437
commit 5237159987
2 changed files with 10 additions and 4 deletions

View file

@ -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.13.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.13.4 (2026-01-29)
### Security

View file

@ -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;