From 5691463bd38583e3fa52954e131bc5e3b3697105 Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Wed, 29 Jul 2026 11:52:13 +0200 Subject: [PATCH] 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 --- Elysium.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Elysium.ps1 b/Elysium.ps1 index 428ab0e..90cc6e9 100644 --- a/Elysium.ps1 +++ b/Elysium.ps1 @@ -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 {