From 33a4c2bf9d71ab20c77b4dbcfd00a15af9a0a746 Mon Sep 17 00:00:00 2001 From: ThioJoe <12518330+ThioJoe@users.noreply.github.com> Date: Sun, 17 Aug 2025 13:43:04 -0700 Subject: [PATCH] Add check to startup script to ensure running within sandbox --- Startup Scripts/SandboxStartup.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Startup Scripts/SandboxStartup.ps1 b/Startup Scripts/SandboxStartup.ps1 index 714ded3..0e4c62f 100644 --- a/Startup Scripts/SandboxStartup.ps1 +++ b/Startup Scripts/SandboxStartup.ps1 @@ -7,6 +7,15 @@ param( #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 reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve