docs: fix test-environment scripts after first live run

Declare the service account DN before the OU loop and print the LDAP result
code and server message when the password-change check fails.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3t4WL7bd9bdHHNjEsxzqC
This commit is contained in:
2026-10-17 17:56:03 +02:00
co-authored by Claude Sonnet 5.5
parent 73505ac717
commit 5f72ea8db6
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -134,7 +134,13 @@ if ($TestPasswordChange) {
$add.Name = 'unicodePwd'; $add.Operation = 'Add'; [void]$add.Add($enc.GetBytes('"' + $newPw + '"'))
$ok = $true; $detail = ''
try { [void]$conn.SendRequest((New-Object System.DirectoryServices.Protocols.ModifyRequest($userDn, @($del, $add)))) }
catch { $ok = $false; $detail = $_.Exception.Message }
catch {
$ok = $false; $detail = $_.Exception.Message
$inner = $_.Exception.InnerException
if ($inner -is [System.DirectoryServices.Protocols.DirectoryOperationException]) {
$detail += " [LDAP result: $($inner.Response.ResultCode); server: $($inner.Response.ErrorMessage)]"
}
}
Report 'change a password with the Change Password right' $ok $detail
}
else { Write-Host 'SKIP password change (use -TestPasswordChange; it changes the test user password)' -ForegroundColor Yellow }