Add check to startup script to ensure running within sandbox

pull/12/head
ThioJoe 2025-08-17 13:43:04 -07:00
parent 74704b6fc4
commit 33a4c2bf9d
No known key found for this signature in database
GPG Key ID: 2E328FE64CC3898C
1 changed files with 9 additions and 0 deletions

View File

@ -7,6 +7,15 @@ param(
#Set-PSDebug -Trace 1 #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"
if ($env:USERNAME -ne "WDAGUtilityAccount") {
Write-host "`n`nERROR: This script is intended to be run from WITHIN the Windows Sandbox.`nIt appears you are running this from outside the sandbox.`n" -ForegroundColor Red
Write-host "`nPress Enter to exit." -ForegroundColor Yellow
Read-Host
exit
}
# Change context menu to old style # Change context menu to old style
reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve