Skip to content

Instantly share code, notes, and snippets.

@howellcc
Created July 1, 2025 18:46
Show Gist options
  • Save howellcc/0b4eceacdc9e4d6559ff3fe2b6b4fd3a to your computer and use it in GitHub Desktop.
Save howellcc/0b4eceacdc9e4d6559ff3fe2b6b4fd3a to your computer and use it in GitHub Desktop.
Windows Sandbox With Winget and Software Install

Windows Sandbox with WinGet and Software Install

Directions

  1. Create a folder on your desktop called Sandbox.
  2. Copy both files to that folder.
  3. Edit SandboxWithSoftware.wsb and correct file path on lines 11 replacing the {username} placeholder. SAVE
  4. Edit InstallWingetAndSoftware.ps1 line 12 to include all software you want installed via winget. SAVE
  5. Double-click SandboxWithSoftware.wsb.

Enjoy!

#Install WinGet, used https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox
Start-Transcript C:\users\wdagutilityaccount\desktop\Installing.txt
$progressPreference = 'silentlyContinue'
Write-Information "Downloading WinGet and its dependencies..."
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force:$true
Install-Module Microsoft.WinGet.Client -Force:$true -Confirm:$false
Import-Module Microsoft.WinGet.Client
Repair-WinGetPackageManager -Force:$true -Latest
#Install software
$SoftwareToInstall = "Notepad++.Notepad++", "Brave.Brave"
foreach ($Software in $SoftwareToInstall) {
WinGet.exe install $software --silent --force --accept-source-agreements --disable-interactivity --source winget
}
Stop-Transcript
Rename-Item -Path C:\users\wdagutilityaccount\desktop\Installing.txt -NewName C:\users\wdagutilityaccount\desktop\Done.txt
<Configuration>
<!-- Indicates whether the virtualized GPU is enabled. Default: true -->
<!-- <VGpu>Default</VGpu> -->
<!-- Indicates whether networking is enabled. Default: true -->
<!-- <Networking>Default</Networking> -->
<!-- Indicates whether mapped folders are read-only. -->
<MappedFolders>
<MappedFolder>
<HostFolder>C:\users\{username}\Desktop\Sandbox</HostFolder>
<SandboxFolder>C:\Sandbox</SandboxFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
</MappedFolders> -->
<!-- Specifies startup commands to run inside the sandbox. -->
<LogonCommand>
<Command>powershell -executionpolicy unrestricted -command "start powershell {-noexit -file C:\Sandbox\InstallWingetAndSoftware.ps1}"</Command>
</LogonCommand>
<!-- Enables or disables audio input. Default: true -->
<AudioInput>false</AudioInput>
<!-- Enables or disables video input. Default: false -->
<VideoInput>false</VideoInput>
<!-- Enables or disables printers. Default: true -->
<PrinterRedirection>false</PrinterRedirection>
<!-- Enables or disables clipboard sharing. Default: true -->
<!-- <ClipboardRedirection>Default</ClipboardRedirection> -->
<!-- Enables or disables protected client. Default: false -->
<!-- <ProtectedClient>Default</ProtectedClient> -->
<!-- Enables or disables memory in MB. Default: dynamic based on host -->
<!-- <MemoryInMB>2048</MemoryInMB> -->
<!-- Enables or disables the virtual GPU's accelerated rendering. Default: true -->
<!-- <EnableVirtualGPU>Default</EnableVirtualGPU> -->
<!-- Indicates whether the Sandbox should run with elevated privileges. Default: false -->
<!-- <RunAsAdmin>false</RunAsAdmin> -->
</Configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment