Add optional debug tracing and final pause

- Add $debugTrace flag instead of uncommenting to to debug
- Add a Read-Host pause at the end when debug tracing is enabled so output can be examined.
- Fix consistency of reg call
main
ThioJoe 2026-04-16 10:49:20 -07:00
parent 532425e2a0
commit a5d737eaee
No known key found for this signature in database
GPG Key ID: 2E328FE64CC3898C
1 changed files with 7 additions and 2 deletions

View File

@ -5,7 +5,10 @@ param(
[switch]$launchingSandbox
)
#Set-PSDebug -Trace 1
# Set to $true to enable debug tracing of the script.
$debugTrace = $false
if ($debugTrace) { Set-PSDebug -Trace 1 }
# ------ Check that we're running in the Windows Sandbox ------
# This script is intended to be run from within the Windows Sandbox. We'll do a rudamentary check for if the current user is named "WDAGUtilityAccount"
@ -17,7 +20,7 @@ if ($env:USERNAME -ne "WDAGUtilityAccount") {
}
# Change context menu to old style
reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
# Show file extensions
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
@ -142,3 +145,5 @@ if ($launchingSandbox) { Start-Process explorer.exe C:\Users\WDAGUtilityAccount\
# Uncomment to pause after running
#Read-Host "Pause"
# If set to trace debug by uncommenting "Set-PSDebug -Trace 1" above, pause at the end so you can see the debug output
if ($debugTrace) { Read-Host "Debug trace complete, press Enter to exit." }