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.
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user