fix(Elysium): catch sub-script errors instead of crashing the menu

The menu loop had try/finally with no catch. Update-KHDB.ps1,
Test-WeakADPasswords.ps1, and Extract-NTHashes.ps1 all run under
$ErrorActionPreference = 'Stop' and re-throw on failure, so any
runtime error (bad credentials, unreachable DC, network failure)
propagated uncaught through the parent and killed the whole
orchestrator instead of returning to the menu. Wrapped the switch in
try/catch so a failed option reports the error and redisplays the
menu.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-29 11:52:13 +02:00
parent 91d6bcb216
commit 5691463bd3
+4
View File
@@ -109,6 +109,7 @@ try {
do {
Show-Menu
$userSelection = Read-Host "Please make a selection"
try {
switch ($userSelection) {
'1' {
Write-Host "Downloading KHDB..."
@@ -149,6 +150,9 @@ do {
Write-Host "Invalid selection, please try again."
}
}
} catch {
Write-Error ("An error occurred while running the selected option: {0}" -f $_.Exception.Message)
}
pause
} while ($userSelection -ne '6')
} finally {