From 2b82dbd1f0beb18ba85887bb2d3b456648a15cc2 Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Wed, 4 Nov 2026 09:25:23 +0100 Subject: [PATCH] fix(Test-WeakADPasswords): relaunch under Windows PowerShell like Extract-NTHashes The menu routes option 2 to powershell.exe, but running the script directly under pwsh skipped that: unlike Extract-NTHashes.ps1 it never called Restart-WithWindowsPowerShellIfAvailable, despite AGENTS.md saying it does. It then loaded DSInternals via -UseWindowsPowerShell implicit remoting, which hands back deserialized objects instead of live DSAccount instances for the Get-ADReplAccount | Test-PasswordQuality pipeline. Added the same relaunch call right after the common helper import. The -UseWindowsPowerShell path stays as the fallback for hosts with no powershell.exe. Parse-checked only; the relaunch itself needs a Windows host. --- Test-WeakADPasswords.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/Test-WeakADPasswords.ps1 b/Test-WeakADPasswords.ps1 index 63abb81..1ce4d27 100644 --- a/Test-WeakADPasswords.ps1 +++ b/Test-WeakADPasswords.ps1 @@ -27,6 +27,7 @@ Set-StrictMode -Version Latest [string]$commonHelper = Join-Path -Path $PSScriptRoot -ChildPath 'Elysium.Common.ps1' if (-not (Test-Path -LiteralPath $commonHelper)) { throw "Common helper not found at $commonHelper" } . $commonHelper +Restart-WithWindowsPowerShellIfAvailable -BoundParameters $PSBoundParameters -UnboundArguments $MyInvocation.UnboundArguments $VerbosePreference = "SilentlyContinue"