Customize Windows Sandbox

Published 04-28-2021 06:09 AM 7,415 Views
Microsoft

In this blog post, I will show you how you can set up, configure and customize Windows Sandbox in Windows 10 using advanced Windows Sandbox config files. Windows Sandbox is based on Hyper-V technology and allows you to spin up an isolated, temporary desktop environment where you can run untrusted software.

 

What is Windows Sandbox

 

Windows Sandbox provides a lightweight desktop environment to run applications in isolation safely. Software installed inside the Windows Sandbox environment remains "sandboxed" and runs separately from the host machine.

A sandbox is temporary. When it's closed, all the software and files and the state are deleted. You get a brand-new instance of the sandbox every time you open the application.

Software and applications installed on the host aren't directly available in the sandbox. If you need specific applications available inside the Windows Sandbox environment, they must be explicitly installed within the environment.

 

Windows Sandbox has the following properties:

 

  • Part of Windows: Everything required for this feature is included in Windows 10 Pro and Enterprise. There's no need to download a VHD.
  • Pristine: Every time Windows Sandbox runs, it's as clean as a brand-new installation of Windows.
  • Disposable: Nothing persists on the device. Everything is discarded when the user closes the application.
  • Secure: Uses hardware-based virtualization for kernel isolation. It relies on the Microsoft hypervisor to run a separate kernel that isolates Windows Sandbox from the host.
  • Efficient: Uses the integrated kernel scheduler, smart memory management, and virtual GPU.

You can learn more about Windows Sandbox on Microsoft Docs and if you are interested in how Windows Sandbox works, check out the Windows architecture here.

 

How to install Windows Sandbox

 

To get started with Windows Sandbox, you will need to have the following prerequisites:

 

  • Windows 10 Pro, Enterprise or Education build 18305 or later (Windows Sandbox is currently not supported on Home SKUs)
  • 64-bit architecture
  • Virtualization capabilities enabled in BIOS
  • At least 4 GB of RAM (8 GB recommended)
  • At least 1 GB of free disk space (SSD recommended)
  • At least two CPU cores (four cores with hyperthreading recommended)

You can install Windows Sandbox as an additional feature in the Control Panel or by simply running the following PowerShell command as administrator:

 

 

Enable-WindowsOptionalFeature -FeatureName "Containers-DisposableClientVM" -All -Online

 

 

After running that command, you will need to restart your computer, and after the reboot, you can start using the Windows Sandbox directly from the Start menu.

 

 

Customize Windows Sandbox with Configuration Files

 

By default, Windows Sandbox spins up a default image. However, in many cases, you want to spin up a customized environment with already preinstalled tools or access to local files. For that, you can use config files that allow you to customize the sandbox during startup. The sandbox configuration files are formatted as XML and use the .wsb file extension.

 

Customize Windows Sandbox with Configuration FilesCustomize Windows Sandbox with Configuration Files

 

Today, you can configure four different settings to configure the Windows Sandbox.

 

  • vGPU (virtualized GPU): Enable or disable the virtualized GPU. If vGPU is disabled, the sandbox will use Windows Advanced Rasterization Platform (WARP).
  • Networking: Enable or disable network access within the sandbox.
  • Mapped folders: Share folders from the host with read or write permissions. Note that exposing host directories may allow malicious software to affect the system or steal data.
  • Logon command: A command that's executed when Windows Sandbox starts.
  • Audio input: Shares the host's microphone input into the sandbox.
  • Video input: Shares the host's webcam input into the sandbox.
  • Protected client: Places increased security settings on the RDP session to the sandbox.
  • Printer redirection: Shares printers from the host into the sandbox.
  • Clipboard redirection: Shares the host clipboard with the sandbox so that text and files can be pasted back and forth.
  • Memory in MB: The amount of memory, in megabytes, to assign to the sandbox.

To create a configuration file, open your editor of choice and create a file with the file extension ".wsb".  Now you can start building the config using XML.

Windows Sandbox Configuration Files WSB FilesWindows Sandbox Configuration Files WSB Files

Let's start with a simple configuration file, which mounts the Downloads folder of the local machine into the Windows Sandbox as read-only. This allows you to use the files from your Downloads folder in your Sandbox. However, the Sandbox cannot write back to that folder.

 

In addition, we also use the Command part to open up the explorer.exe with the mounted Downloads folder when the Windows Sandbox starts. 

 

 

<Configuration>
<VGpu>Default</VGpu>
<Networking>Default</Networking>
<MappedFolders>
   <MappedFolder>
     <HostFolder>C:\Users\thoma\Downloads</HostFolder>
     <ReadOnly>true</ReadOnly>
   </MappedFolder>
</MappedFolders>
<LogonCommand>
   <Command>explorer.exe C:\users\WDAGUtilityAccount\Desktop\Downloads</Command>
</LogonCommand>
</Configuration>

 

 

I saved this as "Sandbox Map Download Folder.wsb". To start Windows Sandbox with the configuration file, double click the configuration file or open it up in the console.

 

Windows Sandbox Configuration Files start from Windows TerminalWindows Sandbox Configuration Files start from Windows Terminal

After that, Windows Sandbox will open with the mounted Downloads folder.

 

Windows Sandbox Mounted FolderWindows Sandbox Mounted Folder

Another example I want to share here is how you can run a script to modify or installed software. In this case, I want to have a Windows Sandbox with Visual Studio Code installed. For that, I use the folder option to mount a folder with a script, and within that script, I have the installation commands. After the Windows Sandbox has started, it will run the script from the mounted folder using the command option.

 

 

 

<Configuration>
<MappedFolders>
   <MappedFolder>
     <HostFolder>C:\Users\thoma\Code\Repos\Scripts\Windows Sandbox\WindowsSandboxScripts</HostFolder>
     <ReadOnly>true</ReadOnly>
   </MappedFolder>
</MappedFolders>
<LogonCommand>
   <Command>C:\users\wdagutilityaccount\desktop\WindowsSandboxScripts\InstallVSCode.cmd</Command>
</LogonCommand>
</Configuration>

 

 

The InstallVSCode.cmd looks like the following:

 

 

REM Download VSCode
curl -L "https://update.code.visualstudio.com/latest/win32-x64-user/stable" --output C:\users\WDAGUtilityAccount\Desktop\vscode.exe
 
REM Install and run VSCode
C:\users\WDAGUtilityAccount\Desktop\vscode.exe /verysilent /suppressmsgboxes

 

 

These are just some of the examples of how you can customize your Windows Sandbox environments. If you want to learn more, check out Microsoft Docs.

Make Visual Studio Code handle .wsb file with XML

By default, editors don't necessarily know about the wsb file extension and that this includes XML syntax. In Visual Studio Code, you can open up the Settings (JSON) and add the following to the files.associations. 

 

Visual Studio CodeVisual Studio Code

In the JSON settings, search for files.associations. Note: The searched section might be there or not.

If it is not there, add the following:

 

 

 

"files.associations": {
      "*.wsb": "xml"
}

 

 

Conclusion

I hope this provides you with a short overview of how you can customize the Windows Sandbox. I am interested in what customization you are running. If you have any questions, feel free to leave a comment or share your customization.

4 Comments
Occasional Visitor

Very exciting. Now we don't have to make dirty our primary machine when we have to try something temporarily.  

 

Great  Work!

Occasional Visitor

This is great!  The one thing that I'd really like to figure out how to do is to keep the Sandbox OS version upgraded with the latest from Windows update.  Or maybe the same as what is on the host machine.  It would be ideal if it didn't have to update every time I started it up, though.

Occasional Visitor

Hi Tom, what about your experience or simply kind of possibilitis to mount an ISO file into Windows Sanbox? Is it somehow a limitation?

Cheers, Ákos

Senior Member

@James_Mauch it turns out that the Sandbox will always be launching an updated version with the latest binaries from Windows Update. This is because the Sandbox shares many of the host files, so when the host is updated the Sandbox automatically benefits from the update. There is a bug where Sandbox may not show the correct build number (so it may look like the update was not applied) but functionally it was.

%3CLINGO-SUB%20id%3D%22lingo-sub-2301354%22%20slang%3D%22en-US%22%3ECustomize%20Windows%20Sandbox%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2301354%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EIn%20this%20blog%20post%2C%20I%20will%20show%20you%20how%20you%20can%20set%20up%2C%20configure%20and%20customize%20Windows%20Sandbox%20in%20Windows%2010%20using%20advanced%20Windows%20Sandbox%20config%20files.%26nbsp%3BWindows%20Sandbox%20is%20based%20on%20Hyper-V%20technology%20and%20allows%20you%20to%20spin%20up%20an%20isolated%2C%20temporary%20desktop%20environment%20where%20you%20can%20run%20untrusted%20software.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--471644562%22%20id%3D%22toc-hId--471644562%22%20id%3D%22toc-hId--471644562%22%20id%3D%22toc-hId--471644562%22%20id%3D%22toc-hId--471644562%22%20id%3D%22toc-hId--471644562%22%20id%3D%22toc-hId--471644562%22%20id%3D%22toc-hId--471671568%22%3E%3CSPAN%3EWhat%20is%20Windows%20Sandbox%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWindows%20Sandbox%20provides%20a%20lightweight%20desktop%20environment%20to%20run%20applications%20in%20isolation%20safely.%20Software%20installed%20inside%20the%20Windows%20Sandbox%20environment%20remains%20%22sandboxed%22%20and%20runs%20separately%20from%20the%20host%20machine.%3C%2FP%3E%0A%3CP%3EA%20sandbox%20is%20temporary.%20When%20it's%20closed%2C%20all%20the%20software%20and%20files%20and%20the%20state%20are%20deleted.%20You%20get%20a%20brand-new%20instance%20of%20the%20sandbox%20every%20time%20you%20open%20the%20application.%3C%2FP%3E%0A%3CP%3ESoftware%20and%20applications%20installed%20on%20the%20host%20aren't%20directly%20available%20in%20the%20sandbox.%20If%20you%20need%20specific%20applications%20available%20inside%20the%20Windows%20Sandbox%20environment%2C%20they%20must%20be%20explicitly%20installed%20within%20the%20environment.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWindows%20Sandbox%20has%20the%20following%20properties%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EPart%20of%20Windows%3C%2FSTRONG%3E%3A%20Everything%20required%20for%20this%20feature%20is%20included%20in%20Windows%2010%20Pro%20and%20Enterprise.%20There's%20no%20need%20to%20download%20a%20VHD.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EPristine%3C%2FSTRONG%3E%3A%20Every%20time%20Windows%20Sandbox%20runs%2C%20it's%20as%20clean%20as%20a%20brand-new%20installation%20of%20Windows.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EDisposable%3C%2FSTRONG%3E%3A%20Nothing%20persists%20on%20the%20device.%20Everything%20is%20discarded%20when%20the%20user%20closes%20the%20application.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ESecure%3C%2FSTRONG%3E%3A%20Uses%20hardware-based%20virtualization%20for%20kernel%20isolation.%20It%20relies%20on%20the%20Microsoft%20hypervisor%20to%20run%20a%20separate%20kernel%20that%20isolates%20Windows%20Sandbox%20from%20the%20host.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EEfficient%3A%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3EUses%20the%20integrated%20kernel%20scheduler%2C%20smart%20memory%20management%2C%20and%20virtual%20GPU.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EYou%20can%20learn%20more%20about%20Windows%20Sandbox%20on%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fwindows%2Fsecurity%2Fthreat-protection%2Fwindows-sandbox%2Fwindows-sandbox-overview%3FWT.mc_id%3Dmodinfra-16866-thmaure%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EMicrosoft%20Docs%3C%2FA%3E%26nbsp%3Band%20if%20you%20are%20interested%20in%20how%20Windows%20Sandbox%20works%2C%20check%20out%20the%20Windows%20architecture%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fwindows%2Fsecurity%2Fthreat-protection%2Fwindows-sandbox%2Fwindows-sandbox-architecture%3FWT.mc_id%3Dmodinfra-16866-thmaure%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-2015868271%22%20id%3D%22toc-hId-2015868271%22%20id%3D%22toc-hId-2015868271%22%20id%3D%22toc-hId-2015868271%22%20id%3D%22toc-hId-2015868271%22%20id%3D%22toc-hId-2015868271%22%20id%3D%22toc-hId-2015868271%22%20id%3D%22toc-hId-2015841265%22%3EHow%20to%20install%20Windows%20Sandbox%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20get%20started%20with%20Windows%20Sandbox%2C%20you%20will%20need%20to%20have%20the%20following%20prerequisites%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EWindows%2010%20Pro%2C%20Enterprise%20or%20Education%20build%2018305%20or%20later%20(%3CEM%3EWindows%20Sandbox%20is%20currently%20not%20supported%20on%20Home%20SKUs%3C%2FEM%3E)%3C%2FLI%3E%0A%3CLI%3E64-bit%20architecture%3C%2FLI%3E%0A%3CLI%3EVirtualization%20capabilities%20enabled%20in%20BIOS%3C%2FLI%3E%0A%3CLI%3EAt%20least%204%20GB%20of%20RAM%20(8%20GB%20recommended)%3C%2FLI%3E%0A%3CLI%3EAt%20least%201%20GB%20of%20free%20disk%20space%20(SSD%20recommended)%3C%2FLI%3E%0A%3CLI%3EAt%20least%20two%20CPU%20cores%20(four%20cores%20with%20hyperthreading%20recommended)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EYou%20can%20install%20Windows%20Sandbox%20as%20an%20additional%20feature%20in%20the%20Control%20Panel%20or%20by%20simply%20running%20the%20following%20PowerShell%20command%20as%20administrator%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EEnable-WindowsOptionalFeature%20-FeatureName%20%22Containers-DisposableClientVM%22%20-All%20-Online%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20running%20that%20command%2C%20you%20will%20need%20to%20restart%20your%20computer%2C%20and%20after%20the%20reboot%2C%20you%20can%20start%20using%20the%20Windows%20Sandbox%20directly%20from%20the%20Start%20menu.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%3CDIV%20class%3D%22video-embed-center%20video-embed%22%3E%3CIFRAME%20class%3D%22embedly-embed%22%20src%3D%22https%3A%2F%2Fcdn.embedly.com%2Fwidgets%2Fmedia.html%3Fsrc%3Dhttps%253A%252F%252Fwww.youtube.com%252Fembed%252F2Vtd12ek9vg%26amp%3Bdisplay_name%3DYouTube%26amp%3Burl%3Dhttps%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253D2Vtd12ek9vg%26amp%3Bimage%3Dhttp%253A%252F%252Fi.ytimg.com%252Fvi%252F2Vtd12ek9vg%252Fhqdefault.jpg%26amp%3Bkey%3Dfad07bfa4bd747d3bdea27e17b533c0e%26amp%3Btype%3Dtext%252Fhtml%26amp%3Bschema%3Dyoutube%22%20width%3D%22600%22%20height%3D%22337%22%20scrolling%3D%22no%22%20title%3D%22YouTube%20embed%22%20frameborder%3D%220%22%20allow%3D%22autoplay%3B%20fullscreen%22%20allowfullscreen%3D%22true%22%3E%3C%2FIFRAME%3E%3C%2FDIV%3E%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-208413808%22%20id%3D%22toc-hId-208413808%22%20id%3D%22toc-hId-208413808%22%20id%3D%22toc-hId-208413808%22%20id%3D%22toc-hId-208413808%22%20id%3D%22toc-hId-208413808%22%20id%3D%22toc-hId-208413808%22%20id%3D%22toc-hId-208386802%22%3ECustomize%20Windows%20Sandbox%20with%20Configuration%20Files%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBy%20default%2C%20Windows%20Sandbox%20spins%20up%20a%20default%20image.%20However%2C%20in%20many%20cases%2C%20you%20want%20to%20spin%20up%20a%20customized%20environment%20with%20already%20preinstalled%20tools%20or%20access%20to%20local%20files.%20For%20that%2C%20you%20can%20use%20config%20files%20that%20allow%20you%20to%20customize%20the%20sandbox%20during%20startup.%20The%20sandbox%20configuration%20files%20are%20formatted%20as%20XML%20and%20use%20the%20.wsb%20file%20extension.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SandboxConfigFile.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276214iB7E4C63C23D091EE%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22SandboxConfigFile.png%22%20alt%3D%22Customize%20Windows%20Sandbox%20with%20Configuration%20Files%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ECustomize%20Windows%20Sandbox%20with%20Configuration%20Files%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EToday%2C%20you%20can%20configure%20four%20different%20settings%20to%20configure%20the%20Windows%20Sandbox.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EvGPU%20(virtualized%20GPU)%3C%2FSTRONG%3E%3A%20Enable%20or%20disable%20the%20virtualized%20GPU.%20If%20vGPU%20is%20disabled%2C%20the%20sandbox%20will%20use%20Windows%20Advanced%20Rasterization%20Platform%20(WARP).%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ENetworking%3C%2FSTRONG%3E%3A%20Enable%20or%20disable%20network%20access%20within%20the%20sandbox.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EMapped%20folders%3C%2FSTRONG%3E%3A%20Share%20folders%20from%20the%20host%20with%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eread%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eor%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Ewrite%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Epermissions.%20Note%20that%20exposing%20host%20directories%20may%20allow%20malicious%20software%20to%20affect%20the%20system%20or%20steal%20data.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ELogon%20command%3C%2FSTRONG%3E%3A%20A%20command%20that's%20executed%20when%20Windows%20Sandbox%20starts.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EAudio%20input%3C%2FSTRONG%3E%3A%20Shares%20the%20host's%20microphone%20input%20into%20the%20sandbox.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EVideo%20input%3C%2FSTRONG%3E%3A%20Shares%20the%20host's%20webcam%20input%20into%20the%20sandbox.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EProtected%20client%3C%2FSTRONG%3E%3A%20Places%20increased%20security%20settings%20on%20the%20RDP%20session%20to%20the%20sandbox.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EPrinter%20redirection%3C%2FSTRONG%3E%3A%20Shares%20printers%20from%20the%20host%20into%20the%20sandbox.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EClipboard%20redirection%3C%2FSTRONG%3E%3A%20Shares%20the%20host%20clipboard%20with%20the%20sandbox%20so%20that%20text%20and%20files%20can%20be%20pasted%20back%20and%20forth.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EMemory%20in%20MB%3C%2FSTRONG%3E%3A%20The%20amount%20of%20memory%2C%20in%20megabytes%2C%20to%20assign%20to%20the%20sandbox.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ETo%20create%20a%20configuration%20file%2C%20open%20your%20editor%20of%20choice%20and%20create%20a%20file%20with%20the%20file%20extension%20%22.wsb%22.%26nbsp%3B%20Now%20you%20can%20start%20building%20the%20config%20using%20XML.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Windows%20Sandbox%20Configuration%20Files%20WSB%20Files.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276217i3BF1B5BC9DD31624%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Windows%20Sandbox%20Configuration%20Files%20WSB%20Files.jpg%22%20alt%3D%22Windows%20Sandbox%20Configuration%20Files%20WSB%20Files%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EWindows%20Sandbox%20Configuration%20Files%20WSB%20Files%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ELet's%20start%20with%20a%20simple%20configuration%20file%2C%20which%20mounts%20the%20Downloads%20folder%20of%20the%20local%20machine%20into%20the%20Windows%20Sandbox%20as%20read-only.%20This%20allows%20you%20to%20use%20the%20files%20from%20your%20Downloads%20folder%20in%20your%20Sandbox.%20However%2C%20the%20Sandbox%20cannot%20write%20back%20to%20that%20folder.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20addition%2C%20we%20also%20use%20the%20Command%20part%20to%20open%20up%20the%20explorer.exe%20with%20the%20mounted%20Downloads%20folder%20when%20the%20Windows%20Sandbox%20starts.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3E%3CCONFIGURATION%3E%0A%3CVGPU%3EDefault%3C%2FVGPU%3E%0A%3CNETWORKING%3EDefault%3C%2FNETWORKING%3E%0A%3CMAPPEDFOLDERS%3E%0A%20%20%20%3CMAPPEDFOLDER%3E%0A%20%20%20%20%20%3CHOSTFOLDER%3EC%3A%5CUsers%5Cthoma%5CDownloads%3C%2FHOSTFOLDER%3E%0A%20%20%20%20%20%3CREADONLY%3Etrue%3C%2FREADONLY%3E%0A%20%20%20%3C%2FMAPPEDFOLDER%3E%0A%3C%2FMAPPEDFOLDERS%3E%0A%3CLOGONCOMMAND%3E%0A%20%20%20%3CCOMMAND%3Eexplorer.exe%20C%3A%5Cusers%5CWDAGUtilityAccount%5CDesktop%5CDownloads%3C%2FCOMMAND%3E%0A%3C%2FLOGONCOMMAND%3E%0A%3C%2FCONFIGURATION%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20saved%20this%20as%20%22%3CSTRONG%3ESandbox%20Map%20Download%20Folder.wsb%3C%2FSTRONG%3E%22.%20To%20start%20Windows%20Sandbox%20with%20the%20configuration%20file%2C%20double%20click%20the%20configuration%20file%20or%20open%20it%20up%20in%20the%20console.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Windows%20Sandbox%20Configuration%20Files%20start%20from%20Windows%20Terminal.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276224iAFADF0D401A9266B%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Windows%20Sandbox%20Configuration%20Files%20start%20from%20Windows%20Terminal.jpg%22%20alt%3D%22Windows%20Sandbox%20Configuration%20Files%20start%20from%20Windows%20Terminal%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EWindows%20Sandbox%20Configuration%20Files%20start%20from%20Windows%20Terminal%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAfter%20that%2C%20Windows%20Sandbox%20will%20open%20with%20the%20mounted%20Downloads%20folder.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Windows%20Sandbox%20Mounted%20Folder.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276225i2FF0839DE746294D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Windows%20Sandbox%20Mounted%20Folder.jpg%22%20alt%3D%22Windows%20Sandbox%20Mounted%20Folder%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EWindows%20Sandbox%20Mounted%20Folder%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAnother%20example%20I%20want%20to%20share%20here%20is%20how%20you%20can%20run%20a%20script%20to%20modify%20or%20installed%20software.%20In%20this%20case%2C%20I%20want%20to%20have%20a%20Windows%20Sandbox%20with%20Visual%20Studio%20Code%20installed.%20For%20that%2C%20I%20use%20the%20folder%20option%20to%20mount%20a%20folder%20with%20a%20script%2C%20and%20within%20that%20script%2C%20I%20have%20the%20installation%20commands.%20After%20the%20Windows%20Sandbox%20has%20started%2C%20it%20will%20run%20the%20script%20from%20the%20mounted%20folder%20using%20the%20command%20option.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3E%3CCONFIGURATION%3E%0A%3CMAPPEDFOLDERS%3E%0A%20%20%20%3CMAPPEDFOLDER%3E%0A%20%20%20%20%20%3CHOSTFOLDER%3EC%3A%5CUsers%5Cthoma%5CCode%5CRepos%5CScripts%5CWindows%20Sandbox%5CWindowsSandboxScripts%3C%2FHOSTFOLDER%3E%0A%20%20%20%20%20%3CREADONLY%3Etrue%3C%2FREADONLY%3E%0A%20%20%20%3C%2FMAPPEDFOLDER%3E%0A%3C%2FMAPPEDFOLDERS%3E%0A%3CLOGONCOMMAND%3E%0A%20%20%20%3CCOMMAND%3EC%3A%5Cusers%5Cwdagutilityaccount%5Cdesktop%5CWindowsSandboxScripts%5CInstallVSCode.cmd%3C%2FCOMMAND%3E%0A%3C%2FLOGONCOMMAND%3E%0A%3C%2FCONFIGURATION%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20InstallVSCode.cmd%20looks%20like%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3EREM%20Download%20VSCode%0Acurl%20-L%20%22https%3A%2F%2Fupdate.code.visualstudio.com%2Flatest%2Fwin32-x64-user%2Fstable%22%20--output%20C%3A%5Cusers%5CWDAGUtilityAccount%5CDesktop%5Cvscode.exe%0A%20%0AREM%20Install%20and%20run%20VSCode%0AC%3A%5Cusers%5CWDAGUtilityAccount%5CDesktop%5Cvscode.exe%20%2Fverysilent%20%2Fsuppressmsgboxes%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThese%20are%20just%20some%20of%20the%20examples%20of%20how%20you%20can%20customize%20your%20Windows%20Sandbox%20environments.%20If%20you%20want%20to%20learn%20more%2C%20check%20out%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fwindows%2Fsecurity%2Fthreat-protection%2Fwindows-sandbox%2Fwindows-sandbox-configure-using-wsb-file%3FWT.mc_id%3Dmodinfra-16866-thmaure%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EMicrosoft%20Docs%3C%2FA%3E.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1599040655%22%20id%3D%22toc-hId--1599040655%22%20id%3D%22toc-hId--1599040655%22%20id%3D%22toc-hId--1599040655%22%20id%3D%22toc-hId--1599040655%22%20id%3D%22toc-hId--1599040655%22%20id%3D%22toc-hId--1599040655%22%20id%3D%22toc-hId--1599067661%22%3EMake%20Visual%20Studio%20Code%20handle%20.wsb%20file%20with%20XML%3C%2FH2%3E%0A%3CP%3EBy%20default%2C%20editors%20don't%20necessarily%20know%20about%20the%20wsb%20file%20extension%20and%20that%20this%20includes%20XML%20syntax.%20In%20Visual%20Studio%20Code%2C%20you%20can%20open%20up%20the%20Settings%20(JSON)%20and%20add%20the%20following%20to%20the%20files.associations.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Visual%20Studio%20Code.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276254i4E76ED2F984B7E27%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Visual%20Studio%20Code.jpg%22%20alt%3D%22Visual%20Studio%20Code%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EVisual%20Studio%20Code%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3EIn%20the%20JSON%20settings%2C%20s%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3Eearch%20for%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%20style%3D%22font-family%3A%20inherit%3B%22%3Efiles.associations%3C%2FEM%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E.%20Note%3A%20The%20searched%20section%20might%20be%20there%20or%20not.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIf%20it%20is%20not%20there%2C%20add%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%22files.associations%22%3A%20%7B%0A%20%20%20%20%20%20%22*.wsb%22%3A%20%22xml%22%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-888472178%22%20id%3D%22toc-hId-888472178%22%20id%3D%22toc-hId-888472178%22%20id%3D%22toc-hId-888472178%22%20id%3D%22toc-hId-888472178%22%20id%3D%22toc-hId-888472178%22%20id%3D%22toc-hId-888472178%22%20id%3D%22toc-hId-888445172%22%3EConclusion%3C%2FH2%3E%0A%3CP%3EI%20hope%20this%20provides%20you%20with%20a%20short%20overview%20of%20how%20you%20can%20customize%20the%20Windows%20Sandbox.%20I%20am%20interested%20in%20what%20customization%20you%20are%20running.%20If%20you%20have%20any%20questions%2C%20feel%20free%20to%20leave%20a%20comment%20or%20share%20your%20customization.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2301354%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EIn%20this%20blog%20post%2C%20I%20will%20show%20you%20how%20you%20can%20set%20up%2C%20configure%20and%20customize%20Windows%20Sandbox%20in%20Windows%2010.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2301354%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EThomas%20Maurer%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2307859%22%20slang%3D%22en-US%22%3ERe%3A%20Customize%20Windows%20Sandbox%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2307859%22%20slang%3D%22en-US%22%3E%3CP%3EVery%20exciting.%20Now%20we%20don't%20have%20to%20make%20dirty%20our%20primary%20machine%20when%20we%20have%20to%20try%20something%20temporarily.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreat%26nbsp%3B%20Work!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2308450%22%20slang%3D%22en-US%22%3ERe%3A%20Customize%20Windows%20Sandbox%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2308450%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20is%20great!%26nbsp%3B%20The%20one%20thing%20that%20I'd%20really%20like%20to%20figure%20out%20how%20to%20do%20is%20to%20keep%20the%20Sandbox%20OS%20version%20upgraded%20with%20the%20latest%20from%20Windows%20update.%26nbsp%3B%20Or%20maybe%20the%20same%20as%20what%20is%20on%20the%20host%20machine.%26nbsp%3B%20It%20would%20be%20ideal%20if%20it%20didn't%20have%20to%20update%20every%20time%20I%20started%20it%20up%2C%20though.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2315239%22%20slang%3D%22en-US%22%3ERe%3A%20Customize%20Windows%20Sandbox%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2315239%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Tom%2C%20what%20about%20your%20experience%20or%20simply%20kind%20of%20possibilitis%20to%20mount%20an%20ISO%20file%20into%20Windows%20Sanbox%3F%20Is%20it%20somehow%20a%20limitation%3F%3C%2FP%3E%3CP%3ECheers%2C%20%C3%81kos%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2317609%22%20slang%3D%22en-US%22%3ERe%3A%20Customize%20Windows%20Sandbox%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2317609%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1041165%22%20target%3D%22_blank%22%3E%40James_Mauch%3C%2FA%3E%26nbsp%3Bit%20turns%20out%20that%20the%20Sandbox%20will%20always%20be%20launching%20an%20updated%20version%20with%20the%20latest%20binaries%20from%20Windows%20Update.%20This%20is%20because%20the%20Sandbox%20shares%20many%20of%20the%20host%20files%2C%20so%20when%20the%20host%20is%20updated%20the%20Sandbox%20automatically%20benefits%20from%20the%20update.%20There%20is%20a%20bug%20where%20Sandbox%20may%20not%20show%20the%20correct%20build%20number%20(so%20it%20may%20look%20like%20the%20update%20was%20not%20applied)%20but%20functionally%20it%20was.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Co-Authors
Version history
Last update:
‎Apr 28 2021 06:10 AM
Updated by: