Skip to content

Commit f7683fe

Browse files
committed
v1.9.59 — Navigation & cleanup
- Fix "home"/"main" nav command in all 10 submenu runners - Fix ReturnToMainMenu flag propagation through ConfigureServerMenu - Fix exit cleanup path dedup to case-insensitive Sort-Object -Unique - Use -Recurse universally in exit cleanup scheduled task
1 parent 619dc7c commit f7683fe

7 files changed

Lines changed: 50 additions & 41 deletions

File tree

Changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## v1.9.59
4+
5+
- **Bug Fix:** "Home"/"main" navigation command now works from all 10 submenu runners — previously, typing `main` or `home` at any submenu fell through to `Test-NavigationCommand` with `Action = "home"` which was never checked, resulting in "Invalid choice" instead of returning to the main menu (49-MenuRunner).
6+
- **Bug Fix:** Return-to-main-menu flag (`$global:ReturnToMainMenu`) now properly bubbles up through `Start-Show-ConfigureServerMenu` — previously, child submenus would set the flag but ConfigureServerMenu cleared it without returning, trapping the user at the Configure Server level instead of navigating all the way back to Main Menu (49-MenuRunner).
7+
- **Enhancement:** Exit cleanup path deduplication now uses `Sort-Object -Unique` (case-insensitive) instead of `Select-Object -Unique` (case-sensitive) — prevents duplicate `Remove-Item` commands in the scheduled task if the same path appears with different casing (47-ExitCleanup).
8+
- **Enhancement:** Exit cleanup scheduled task uses `-Recurse` universally for all paths instead of branching on `Test-Path -PathType Container` at script-exit time — eliminates a race condition where a file could become a directory (or vice versa) between exit and reboot-time execution (47-ExitCleanup).
9+
- 63 modules, 1854 tests
10+
311
## v1.9.58
412

513
- **Bug Fix:** Agent installer site number parsing now wraps the `-split` pipeline in `@()` — single-site filenames (e.g., `Agent.12345.exe`) returned a bare string instead of an array, causing `.Count` to return the string length instead of 1 in PS 5.1 (57-AgentInstaller).

Header.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,18 @@
3030
7h3 4b1d3r
3131
3232
.VERSION
33-
1.9.58
33+
1.9.59
3434
3535
.LAST UPDATED
3636
03/03/2026
3737
38+
.CHANGELOG v1.9.59
39+
NAVIGATION & CLEANUP PATCH:
40+
- FIX: "home"/"main" navigation command now works from all submenus — previously fell through to "Invalid choice" in 10 submenu runners
41+
- FIX: Return-to-main-menu flag now properly bubbles up through Configure Server menu — previously cleared the flag without returning, trapping the user one level deep
42+
- IMPROVED: Exit cleanup path deduplication now uses case-insensitive Sort-Object -Unique instead of case-sensitive Select-Object -Unique
43+
- IMPROVED: Exit cleanup scheduled task uses -Recurse universally for all paths — eliminates stale-path-type risk from test-at-exit vs delete-at-reboot timing gap
44+
3845
.CHANGELOG v1.9.58
3946
DATA SAFETY & VALIDATION PATCH:
4047
- FIX: Agent installer site number parsing now wraps pipeline in @() — single-site filenames no longer fail .Count check in PS 5.1

Modules/00-Initialization.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ if (-not $script:ModuleRoot) { $script:ModuleRoot = $PSScriptRoot }
135135
if (-not $script:ModuleRoot -and $script:ScriptPath) {
136136
$script:ModuleRoot = [System.IO.Path]::GetDirectoryName($script:ScriptPath)
137137
}
138-
$script:ScriptVersion = "1.9.58"
138+
$script:ScriptVersion = "1.9.59"
139139
$script:ScriptStartTime = Get-Date
140140

141141
# OS version detection (for feature compatibility)

Modules/47-ExitCleanup.ps1

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,15 @@ function Exit-Script {
9191
}
9292

9393
# Deduplicate paths
94-
$uniquePaths = $pathsToDelete | Select-Object -Unique
94+
$uniquePaths = $pathsToDelete | Sort-Object -Unique
9595

9696
# Schedule deletion after reboot using a scheduled task
9797
try {
9898
# Build cleanup commands for each path
9999
$cleanupCommands = "Start-Sleep 60`n"
100100
foreach ($p in $uniquePaths) {
101101
$escapedPath = $p -replace "'", "''"
102-
if (Test-Path $p -PathType Container) {
103-
$cleanupCommands += "Remove-Item -LiteralPath '$escapedPath' -Recurse -Force -ErrorAction SilentlyContinue`n"
104-
} else {
105-
$cleanupCommands += "Remove-Item -LiteralPath '$escapedPath' -Force -ErrorAction SilentlyContinue`n"
106-
}
102+
$cleanupCommands += "Remove-Item -LiteralPath '$escapedPath' -Recurse -Force -ErrorAction SilentlyContinue`n"
107103
}
108104
$toolNameEsc = $script:ToolName -replace "'", "''"
109105
$cleanupCommands += "Unregister-ScheduledTask -TaskName '$($toolNameEsc)Cleanup' -Confirm:`$false -ErrorAction SilentlyContinue"

Modules/49-MenuRunner.ps1

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -103,49 +103,39 @@ function Start-Show-ConfigureServerMenu {
103103
if ($navResult.Action -eq "back") {
104104
return
105105
}
106+
if ($navResult.Action -eq "home") {
107+
$global:ReturnToMainMenu = $true
108+
return
109+
}
106110

107111
switch ($choice) {
108112
"1" {
109113
Start-Show-NetworkMenu
110-
if ($global:ReturnToMainMenu) {
111-
$global:ReturnToMainMenu = $false
112-
}
114+
if ($global:ReturnToMainMenu) { return }
113115
}
114116
"2" {
115117
Start-Show-SystemConfigMenu
116-
if ($global:ReturnToMainMenu) {
117-
$global:ReturnToMainMenu = $false
118-
}
118+
if ($global:ReturnToMainMenu) { return }
119119
}
120120
"3" {
121121
Start-Show-RolesFeaturesMenu
122-
if ($global:ReturnToMainMenu) {
123-
$global:ReturnToMainMenu = $false
124-
}
122+
if ($global:ReturnToMainMenu) { return }
125123
}
126124
"4" {
127125
Start-Show-SecurityAccessMenu
128-
if ($global:ReturnToMainMenu) {
129-
$global:ReturnToMainMenu = $false
130-
}
126+
if ($global:ReturnToMainMenu) { return }
131127
}
132128
"5" {
133129
Start-Show-ToolsUtilitiesMenu
134-
if ($global:ReturnToMainMenu) {
135-
$global:ReturnToMainMenu = $false
136-
}
130+
if ($global:ReturnToMainMenu) { return }
137131
}
138132
"6" {
139133
Start-Show-StorageClusteringMenu
140-
if ($global:ReturnToMainMenu) {
141-
$global:ReturnToMainMenu = $false
142-
}
134+
if ($global:ReturnToMainMenu) { return }
143135
}
144136
"7" {
145137
Show-OperationsMenu
146-
if ($global:ReturnToMainMenu) {
147-
$global:ReturnToMainMenu = $false
148-
}
138+
if ($global:ReturnToMainMenu) { return }
149139
}
150140
"8" {
151141
Show-SystemHealthCheck
@@ -183,6 +173,7 @@ function Start-Show-SystemConfigMenu {
183173
$navResult = Test-NavigationCommand -UserInput $choice
184174
if ($navResult.Action -eq "exit") { Exit-Script; return }
185175
if ($navResult.Action -eq "back") { return }
176+
if ($navResult.Action -eq "home") { $global:ReturnToMainMenu = $true; return }
186177

187178
switch ($choice) {
188179
"1" { Set-HostName; Write-PressEnter }
@@ -211,6 +202,7 @@ function Start-Show-RolesFeaturesMenu {
211202
$navResult = Test-NavigationCommand -UserInput $choice
212203
if ($navResult.Action -eq "exit") { Exit-Script; return }
213204
if ($navResult.Action -eq "back") { return }
205+
if ($navResult.Action -eq "home") { $global:ReturnToMainMenu = $true; return }
214206

215207
switch ($choice) {
216208
"1" { Install-HyperVRole; Write-PressEnter }
@@ -236,6 +228,7 @@ function Start-Show-SecurityAccessMenu {
236228
$navResult = Test-NavigationCommand -UserInput $choice
237229
if ($navResult.Action -eq "exit") { Exit-Script; return }
238230
if ($navResult.Action -eq "back") { return }
231+
if ($navResult.Action -eq "home") { $global:ReturnToMainMenu = $true; return }
239232

240233
switch ($choice) {
241234
"1" { Enable-RDP; Write-PressEnter }
@@ -264,6 +257,7 @@ function Start-Show-ToolsUtilitiesMenu {
264257
$navResult = Test-NavigationCommand -UserInput $choice
265258
if ($navResult.Action -eq "exit") { Exit-Script; return }
266259
if ($navResult.Action -eq "back") { return }
260+
if ($navResult.Action -eq "home") { $global:ReturnToMainMenu = $true; return }
267261

268262
switch ($choice) {
269263
"1" { Set-NTPConfiguration; Write-PressEnter }
@@ -297,6 +291,7 @@ function Start-Show-StorageClusteringMenu {
297291
$navResult = Test-NavigationCommand -UserInput $choice
298292
if ($navResult.Action -eq "exit") { Exit-Script; return }
299293
if ($navResult.Action -eq "back") { return }
294+
if ($navResult.Action -eq "home") { $global:ReturnToMainMenu = $true; return }
300295

301296
switch ($choice) {
302297
"1" { Start-StorageManager }
@@ -333,21 +328,19 @@ function Start-Show-NetworkMenu {
333328
if ($navResult.Action -eq "back") {
334329
return
335330
}
331+
if ($navResult.Action -eq "home") {
332+
$global:ReturnToMainMenu = $true
333+
return
334+
}
336335

337336
switch ($networkChoice) {
338337
"1" {
339338
Start-Show-HostNetworkMenu
340-
# Check if we need to bubble up to main menu
341-
if ($global:ReturnToMainMenu) {
342-
return
343-
}
339+
if ($global:ReturnToMainMenu) { return }
344340
}
345341
"2" {
346342
Start-Show-VM-NetworkMenu
347-
# Check if we need to bubble up to main menu
348-
if ($global:ReturnToMainMenu) {
349-
return
350-
}
343+
if ($global:ReturnToMainMenu) { return }
351344
}
352345
"back" {
353346
return
@@ -414,6 +407,10 @@ function Start-Show-HostNetworkMenu {
414407
if ($navResult.Action -eq "back") {
415408
return
416409
}
410+
if ($navResult.Action -eq "home") {
411+
$global:ReturnToMainMenu = $true
412+
return
413+
}
417414

418415
switch ($hostNetworkChoice) {
419416
"1" {
@@ -462,6 +459,7 @@ function Start-Show-VirtualSwitchMenu {
462459
$navResult = Test-NavigationCommand -UserInput $choice
463460
if ($navResult.Action -eq "exit") { Exit-Script; return }
464461
if ($navResult.Action -eq "back") { return }
462+
if ($navResult.Action -eq "home") { $global:ReturnToMainMenu = $true; return }
465463

466464
switch ($choice) {
467465
"1" { New-SwitchEmbeddedTeam -SwitchName $script:SwitchName -ManagementName $script:ManagementName; Write-PressEnter }
@@ -494,6 +492,7 @@ function Start-Show-HostNetworkIPMenu {
494492
$navResult = Test-NavigationCommand -UserInput $vmNetworkChoice
495493
if ($navResult.Action -eq "exit") { Exit-Script; return }
496494
if ($navResult.Action -eq "back") { return }
495+
if ($navResult.Action -eq "home") { $global:ReturnToMainMenu = $true; return }
497496

498497
switch ($vmNetworkChoice) {
499498
"1" {
@@ -515,7 +514,6 @@ function Start-Show-HostNetworkIPMenu {
515514
}
516515
}
517516
"M" {
518-
# Set flag to return all the way to main menu
519517
$global:ReturnToMainMenu = $true
520518
return
521519
}
@@ -545,6 +543,7 @@ function Start-Show-VM-NetworkMenu {
545543
$navResult = Test-NavigationCommand -UserInput $vmNetworkChoice
546544
if ($navResult.Action -eq "exit") { Exit-Script; return }
547545
if ($navResult.Action -eq "back") { return }
546+
if ($navResult.Action -eq "home") { $global:ReturnToMainMenu = $true; return }
548547

549548
switch ($vmNetworkChoice) {
550549
"1" {
@@ -566,7 +565,6 @@ function Start-Show-VM-NetworkMenu {
566565
}
567566
}
568567
"M" {
569-
# Set flag to return all the way to main menu
570568
$global:ReturnToMainMenu = $true
571569
return
572570
}

RackStack.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
Environment-specific settings are configured via defaults.json.
1414
1515
.VERSION
16-
1.9.58
16+
1.9.59
1717
1818
.NOTES
1919
- Requires Windows Server 2012 R2 or later (or Windows 10/11 for testing)

Tests/Run-Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<#
22
.SYNOPSIS
3-
Automated Test Runner for RackStack v1.9.58
3+
Automated Test Runner for RackStack v1.9.59
44
55
.DESCRIPTION
66
Comprehensive non-interactive test suite covering:

0 commit comments

Comments
 (0)