Mastering Windows Sandbox: The Ultimate Tool for Safe Software Testing

Windows Sandbox is a built-in, disposable Windows environment on Windows 10/11 Pro, Enterprise, and Education: it boots a clean Windows in seconds, and closing it wipes everything inside. This guide keeps the original setup walkthrough, adds the part the old version was missing — two ready-to-use .wsb configuration files, one for testing suspicious files and one for a reusable dev environment — plus the limits you need to know before trusting it.

Introduction

If you love testing out new software or experimenting with unverified apps, Windows Sandbox is the fastest safe way to do it. It is far simpler and faster than setting up a dedicated virtual machine, while providing excellent isolation to keep your host system stable and secure. The original version of this guide covered installation and basic use; this rewrite adds the configuration files that turn Sandbox from a demo into a daily tool, and the limits that catch people out.

1. Why Use Windows Sandbox?

  • Built-in component: Everything you need is already included in Windows 10/11 Pro, Enterprise, and Education. No massive VHD downloads required.
  • Native environment: Every time you launch Windows Sandbox, it starts as a pristine, fresh installation of Windows.
  • Disposable: Nothing is persistent. Once you close the application, everything inside is wiped instantly — with one exception covered in the limits section: files in a writable mapped folder stay on the host.
  • Secure: Uses hardware-based virtualization for kernel isolation. It leverages the Microsoft hypervisor to run a separate kernel, keeping the sandbox strictly partitioned from your host.
  • Efficient: Features an integrated kernel scheduler, smart memory management, and virtual GPU acceleration.

It helps to know what you get when you just click the Start menu entry with no configuration file. The default sandbox caps memory at 4 GB, has networking enabled through the Hyper-V default switch, shares the host clipboard so you can paste files in, enables the virtual GPU on non-Arm64 devices, and leaves audio input on while video input, printer redirection, and Protected Client mode stay off. That default is convenient — and it is the wrong default for testing something you do not trust, because networking is on. Section 4 fixes that with a configuration file.

2. Prerequisites

  • Windows 10/11 Pro, Enterprise, or Education. Windows Home edition does not support Sandbox.
  • Virtualization enabled in your BIOS/UEFI.
  • At least 4 GB of RAM (8 GB recommended).
  • At least 1 GB of free disk space (SSD highly recommended).
  • A CPU with at least two cores (hyper-threading recommended).

3. Installation

Ensure you are running Windows 10 (build 18305 or higher) or Windows 11. Then enable virtualization: on physical hardware, turn it on in your BIOS; inside a VM, you need nested virtualization, which you enable from the host with these PowerShell commands:

Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true
Update-VMVersion -VMName <VMName>

Search for “Turn Windows features on or off” in your Start menu. Check the “Windows Sandbox” box, click OK, and restart your computer when prompted.

Windows features dialog showing the Windows Sandbox option
Enabling the Windows Sandbox feature

If the option is missing, your system does not meet the hardware requirements. Alternatively, you can enable it via PowerShell:

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

Launch “Windows Sandbox” from the Start menu. By default, networking is enabled — fine for installing an app you already trust, not fine for a file you suspect. The next section shows how to change that and everything else with a configuration file.

4. Windows Sandbox Configuration Files (.wsb)

A .wsb file is a small XML file that starts Sandbox with your settings instead of the defaults. Configuration files work on Windows 10 build 18342 and higher and on Windows 11. To create one, open a plain text editor such as Notepad, write the configuration between <Configuration> tags, and save it with a .wsb extension — in Notepad, put the filename in double quotation marks, for example "TestFile.wsb", or Notepad will append .txt. Double-click the file to launch Sandbox with those settings.

The options you can control, with their defaults:

OptionWhat it doesDefault
vGPUShare the GPU with the sandbox; disabled means software (WARP) renderingEnabled on non-Arm64
NetworkingNetwork access inside the sandboxEnabled
MappedFoldersShare host folders into the sandbox, read-only or writableNone
LogonCommandOne command run automatically after the sandbox signs inNone
AudioInputShare the host microphone into the sandboxEnabled
VideoInputShare the host webcam into the sandboxDisabled
ProtectedClientExtra AppContainer isolation on the sandbox sessionDisabled
PrinterRedirectionShare host printers into the sandboxDisabled
ClipboardRedirectionShare the clipboard so text and files can be pasted both waysEnabled
MemoryInMBMemory assigned to the sandbox in megabytesUp to 4096

Example A: Testing a Suspicious File (Maximum Isolation)

This is the configuration to reach for when you do not trust the file. Networking is off so nothing inside can reach your LAN or the internet, the GPU is off so the attack surface is smaller, and the sample comes in through a read-only mapped folder — read-only matters, because anything the sample does to that folder cannot touch the host copy. Protected Client mode adds another isolation layer; the trade-off, stated in the docs, is that it may restrict copy and paste, which is exactly why the sample travels through the mapped folder instead of the clipboard.

<Configuration>
  <vGPU>Disable</vGPU>
  <Networking>Disable</Networking>
  <MappedFolders>
    <MappedFolder>
      <HostFolder>C:\Users\Public\Samples</HostFolder>
      <SandboxFolder>C:\Users\WDAGUtilityAccount\Desktop\Samples</SandboxFolder>
      <ReadOnly>true</ReadOnly>
    </MappedFolder>
  </MappedFolders>
  <ProtectedClient>Enable</ProtectedClient>
  <MemoryInMB>4096</MemoryInMB>
</Configuration>

Example B: A Reusable Dev and Test Environment

When the sandbox is a workbench rather than a quarantine cell, the priorities flip: give it real memory, map your project folder with write access so your work survives closing the sandbox, and let a logon script set the environment up for you. The docs note that a LogonCommand runs a single command, so anything multi-step belongs in a script file that you bring in through the shared folder and then execute — that is what this example does. If you want a persistent lightweight environment on Windows instead of a disposable one, the trade-offs are covered in our WSL native containers guide; if you need a full virtual machine that keeps its state, our ESXi Windows 11 IoT guide is the other end of that spectrum.

<Configuration>
  <vGPU>Enable</vGPU>
  <Networking>Enable</Networking>
  <MappedFolders>
    <MappedFolder>
      <HostFolder>C:\Dev\Project</HostFolder>
      <SandboxFolder>C:\Users\WDAGUtilityAccount\Desktop\Project</SandboxFolder>
      <ReadOnly>false</ReadOnly>
    </MappedFolder>
  </MappedFolders>
  <LogonCommand>
    <Command>C:\Users\WDAGUtilityAccount\Desktop\Project\setup.bat</Command>
  </LogonCommand>
  <ClipboardRedirection>Enable</ClipboardRedirection>
  <MemoryInMB>8192</MemoryInMB>
</Configuration>

5. Limitations and Pitfalls

  • Closing wipes everything — except writable mapped folders. Changes made during a session to a mapped folder with write permission persist on the host after the sandbox is disposed. That is the feature in Example B and the trap in Example A: never map a folder writable when testing something untrusted.
  • A mapped host folder must already exist. If the HostFolder path does not exist on the host, the container fails to start. If no SandboxFolder is given, the folder lands on the container user’s desktop.
  • The window size is not configurable. Neither is the sandbox resolution independent of the window.
  • Memory has a floor. If the MemoryInMB value is too small to boot, it is automatically raised to 2048 MB.
  • Protected Client can restrict copy and paste. That is the price of the extra isolation layer; plan file transfer through mapped folders when you enable it.
  • Defaults are permissive. Networking is on by default, which can expose untrusted applications to the internal network, and enabling the virtual GPU increases the attack surface. Both are one line in a .wsb file to switch off.
  • Environment variables in mapped paths need Windows 11 version 23H2 or later. On older builds, use absolute paths.

6. Basic Usage

Without a configuration file, use is simple: copy the executable file from your host and paste it into the Windows Sandbox window, run or install the application inside the sandbox, and when you are done, close the sandbox. You will see a prompt confirming that all data inside will be permanently deleted — click OK, and rest easy knowing your host system remains completely untouched, subject to the mapped-folder exception above.

FAQ

How is Windows Sandbox different from a full virtual machine?

A: Sandbox is a lightweight, disposable Windows that boots in seconds from the host system image and wipes itself on close. A full virtual machine keeps its state, supports snapshots, and needs its own disk image and OS install. Use Sandbox for quick, throwaway tests; use a VM when the environment must persist.

Do files I download in the sandbox survive after I close it?

A: No, with one exception. Everything inside the sandbox is deleted on close. The exception is a mapped folder with write permission: changes to that folder are written to the host and persist after the sandbox is disposed.

What is the safest .wsb setup for testing a suspicious file?

A: Disable Networking and vGPU, bring the file in through a read-only mapped folder, and enable Protected Client mode. That combination keeps the sample offline, limits its access to the host, and prevents it from modifying the folder it came from.

Can I use Windows Sandbox on Windows Home, and how much memory should I give it?

A: No, Sandbox requires Pro, Enterprise, or Education; Home does not include it. The default sandbox caps memory at 4 GB, which is enough for testing most apps. For a dev workload, set MemoryInMB explicitly, for example 8192; if the value is too small to boot, it is automatically raised to 2048 MB.

Resources

Leave a Comment