Launch Windows Sandbox with Winget Enabled
WinGet is not available in the sandbox by default, but you can do that by creating your own .wsb
file:
<Configuration>
<MappedFolders>
<MappedFolder>
<HostFolder>c:\software\sandbox</HostFolder>
<SandboxFolder>c:\software</SandboxFolder>
</MappedFolder>
<MappedFolder>
<HostFolder>C:\Users\alone\Downloads</HostFolder>
<SandboxFolder>C:\Users\WDAGUtilityAccount\Downloads</SandboxFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
</MappedFolders>
<LogonCommand>
<Command>powershell -executionpolicy unrestricted -command "start powershell {-noexit -file C:\software\boot.ps1}"</Command>
</LogonCommand>
</Configuration>
This file will execute boot.ps1
on sandbox login, which is placed into c:\software\sandbox
on the host machine and here is the content:
cd ~
Write-Host "installing winget..."
$ProgressPreference='Silent'
Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.3.2691/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Thanks! You can always email me or use contact form for more questions/comments etc.