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`.
- 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
Added/Updated:
- Robust settings validation and SAS token normalization.

View File

@@ -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
}

View File

@@ -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,6 +56,8 @@ function Uninstall-Elysium {
# Additional cleanup actions can be added here if needed
}
Start-UninstallTranscript
try {
# Execute the uninstall function
Uninstall-Elysium
@@ -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
}