Adding transcripts

This commit is contained in:
2025-10-10 15:29:11 +02:00
parent aa54c751c3
commit be8555316f
3 changed files with 53 additions and 5 deletions

View File

@@ -16,6 +16,14 @@ Updated:
- Added strict error handling (`$ErrorActionPreference='Stop'`) and `Set-StrictMode`. - Added strict error handling (`$ErrorActionPreference='Stop'`) and `Set-StrictMode`.
- Resolved script invocations via `$PSScriptRoot` to avoid CWD issues. - Resolved script invocations via `$PSScriptRoot` to avoid CWD issues.
### Elysium.ps1 v1.2.0
Added:
- Transcript logging to `Reports/logs/orchestrator-<timestamp>.log` and graceful shutdown without `exit`.
### Uninstall.ps1 v1.1.0
Added:
- Transcript logging to `%TEMP%/Elysium/logs/uninstall-<timestamp>.log` so logs persist after directory removal.
### Update-KHDB.ps1 v1.1.0 ### Update-KHDB.ps1 v1.1.0
Added/Updated: Added/Updated:
- Robust settings validation and SAS token normalization. - Robust settings validation and SAS token normalization.

View File

@@ -7,7 +7,7 @@
################################################## ##################################################
## Project: Elysium ## ## Project: Elysium ##
## File: Elysium.ps1 ## ## File: Elysium.ps1 ##
## Version: 1.1.0 ## ## Version: 1.2.0 ##
## Support: support@cqre.net ## ## Support: support@cqre.net ##
################################################## ##################################################
@@ -54,6 +54,21 @@ if ([string]::IsNullOrEmpty($passphrase)) {
# Continue with the rest of your script... # 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 { function Show-Menu {
param ( param (
[string]$Title = 'Elysium Tool Main Menu' [string]$Title = 'Elysium Tool Main Menu'
@@ -67,6 +82,8 @@ function Show-Menu {
Write-Host "5: Exit" Write-Host "5: Exit"
} }
Start-OrchestratorTranscript -BasePath $PSScriptRoot
try {
do { do {
Show-Menu Show-Menu
$userSelection = Read-Host "Please make a selection" $userSelection = Read-Host "Please make a selection"
@@ -89,7 +106,8 @@ do {
} }
'5' { '5' {
Write-Host "Exiting..." Write-Host "Exiting..."
exit # end loop; transcript will be stopped after the loop
$userSelection = '5'
} }
default { default {
Write-Host "Invalid selection, please try again." Write-Host "Invalid selection, please try again."
@@ -97,3 +115,6 @@ do {
} }
pause pause
} while ($userSelection -ne '5') } while ($userSelection -ne '5')
} finally {
Stop-OrchestratorTranscript
}

View File

@@ -7,7 +7,7 @@
################################################## ##################################################
## Project: Elysium ## ## Project: Elysium ##
## File: Uninstall.ps1 ## ## File: Uninstall.ps1 ##
## Version: 1.0.0 ## ## Version: 1.1.0 ##
## Support: support@cqre.net ## ## 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. 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 { function Uninstall-Elysium {
$ElysiumPath = Get-Location $ElysiumPath = Get-Location
@@ -42,8 +56,10 @@ function Uninstall-Elysium {
# Additional cleanup actions can be added here if needed # Additional cleanup actions can be added here if needed
} }
# Execute the uninstall function Start-UninstallTranscript
Uninstall-Elysium try {
# Execute the uninstall function
Uninstall-Elysium
# Check if the Elysium passphrase environment variable exists # Check if the Elysium passphrase environment variable exists
$passphraseEnvVar = [System.Environment]::GetEnvironmentVariable("ELYSIUM_PASSPHRASE", [System.EnvironmentVariableTarget]::User) $passphraseEnvVar = [System.Environment]::GetEnvironmentVariable("ELYSIUM_PASSPHRASE", [System.EnvironmentVariableTarget]::User)
@@ -58,3 +74,6 @@ if ([string]::IsNullOrEmpty($passphraseEnvVar)) {
# Confirm uninstallation # Confirm uninstallation
Write-Host "Elysium tool has been successfully uninstalled. Exiting script." -ForegroundColor Green Write-Host "Elysium tool has been successfully uninstalled. Exiting script." -ForegroundColor Green
} finally {
Stop-UninstallTranscript
}