diff --git a/CHANGELOG.md b/CHANGELOG.md index 9788b88..e840e13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,14 @@ Updated: - Added strict error handling (`$ErrorActionPreference='Stop'`) and `Set-StrictMode`. - Resolved script invocations via `$PSScriptRoot` to avoid CWD issues. +### Elysium.ps1 v1.2.0 +Added: +- Transcript logging to `Reports/logs/orchestrator-.log` and graceful shutdown without `exit`. + +### Uninstall.ps1 v1.1.0 +Added: +- Transcript logging to `%TEMP%/Elysium/logs/uninstall-.log` so logs persist after directory removal. + ### Update-KHDB.ps1 v1.1.0 Added/Updated: - Robust settings validation and SAS token normalization. diff --git a/Elysium.ps1 b/Elysium.ps1 index 6b0ddfd..419bbb9 100644 --- a/Elysium.ps1 +++ b/Elysium.ps1 @@ -7,7 +7,7 @@ ################################################## ## Project: Elysium ## ## File: Elysium.ps1 ## -## Version: 1.1.0 ## +## Version: 1.2.0 ## ## Support: support@cqre.net ## ################################################## @@ -54,6 +54,21 @@ if ([string]::IsNullOrEmpty($passphrase)) { # Continue with the rest of your script... +function Start-OrchestratorTranscript { + param([string]$BasePath) + try { + $logsDir = Join-Path -Path $BasePath -ChildPath 'Reports/logs' + if (-not (Test-Path $logsDir)) { New-Item -Path $logsDir -ItemType Directory -Force | Out-Null } + $ts = Get-Date -Format 'yyyyMMdd-HHmmss' + $logPath = Join-Path -Path $logsDir -ChildPath "orchestrator-$ts.log" + Start-Transcript -Path $logPath -Force | Out-Null + } catch { + Write-Warning "Could not start transcript: $($_.Exception.Message)" + } +} + +function Stop-OrchestratorTranscript { try { Stop-Transcript | Out-Null } catch {} } + function Show-Menu { param ( [string]$Title = 'Elysium Tool Main Menu' @@ -67,6 +82,8 @@ function Show-Menu { Write-Host "5: Exit" } +Start-OrchestratorTranscript -BasePath $PSScriptRoot +try { do { Show-Menu $userSelection = Read-Host "Please make a selection" @@ -89,7 +106,8 @@ do { } '5' { Write-Host "Exiting..." - exit + # end loop; transcript will be stopped after the loop + $userSelection = '5' } default { Write-Host "Invalid selection, please try again." @@ -97,3 +115,6 @@ do { } pause } while ($userSelection -ne '5') +} finally { + Stop-OrchestratorTranscript +} diff --git a/Uninstall.ps1 b/Uninstall.ps1 index 60473b7..de844fa 100644 --- a/Uninstall.ps1 +++ b/Uninstall.ps1 @@ -7,7 +7,7 @@ ################################################## ## Project: Elysium ## ## File: Uninstall.ps1 ## -## Version: 1.0.0 ## +## Version: 1.1.0 ## ## Support: support@cqre.net ## ################################################## @@ -19,6 +19,20 @@ Uninstall script for the Elysium AD password testing tool. This script will remove the Elysium tool and its components (scripts, configurations, and any generated data) from the system, and then delete itself. #> +function Start-UninstallTranscript { + try { + $base = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'Elysium', 'logs') + if (-not (Test-Path $base)) { New-Item -Path $base -ItemType Directory -Force | Out-Null } + $ts = Get-Date -Format 'yyyyMMdd-HHmmss' + $logPath = Join-Path -Path $base -ChildPath "uninstall-$ts.log" + Start-Transcript -Path $logPath -Force | Out-Null + } catch { + Write-Warning "Could not start transcript: $($_.Exception.Message)" + } +} + +function Stop-UninstallTranscript { try { Stop-Transcript | Out-Null } catch {} } + function Uninstall-Elysium { $ElysiumPath = Get-Location @@ -42,8 +56,10 @@ function Uninstall-Elysium { # Additional cleanup actions can be added here if needed } -# Execute the uninstall function -Uninstall-Elysium +Start-UninstallTranscript +try { + # Execute the uninstall function + Uninstall-Elysium # Check if the Elysium passphrase environment variable exists $passphraseEnvVar = [System.Environment]::GetEnvironmentVariable("ELYSIUM_PASSPHRASE", [System.EnvironmentVariableTarget]::User) @@ -58,3 +74,6 @@ if ([string]::IsNullOrEmpty($passphraseEnvVar)) { # Confirm uninstallation Write-Host "Elysium tool has been successfully uninstalled. Exiting script." -ForegroundColor Green +} finally { + Stop-UninstallTranscript +}