How to configure Windows Sandbox on Windows 11

Are you using Windows Sandbox? Here’s how to configure the feature on Windows 11.

When you purchase through links on our site, we may earn an affiliate commission.Here’s how it works.

On Windows 11, you canuse the “Windows Sandbox” featureto create an isolated lightweight virtual machine to test potentially harmful applications without affecting your main setup.

The feature is basically a traditional virtual machine, but this one is a quick solution that doesn’t take up a lot of space and has been optimized for speed, security, and efficiency.

Although out-of-the-box, theWindows 11feature provides an isolation layer, it’s still possible for malicious code to make its way to the main setup using some of the features, such the virtual networking, virtual graphics, and file sharing. However, Windows Sandbox includes many settings you can manage through a configuration file to increase security and perform other tasks, such as running commands and scripts, and redirect peripherals like microphones and cameras to test specific features of an application.

Thisguidewill walk you through the steps to configure the Windows Sandbox feature on Windows 11.

How to create a configuration file for Windows Sandbox

How to create a configuration file for Windows Sandbox

To build a configuration file for Sandbox on Windows 11, use these steps:

After completing the steps, you can continue using Notepad or another text editor, such as Visual Studio Code, to edit the file and build custom configurations for Windows Sandbox.

How to run startup commands on Windows Sandbox

How to run startup commands on Windows Sandbox

To run scripts or commands during login on Sandbox, use these steps:

Get the Windows Central Newsletter

All the latest news, reviews, and guides for Windows and Xbox diehards.

Inside theCommandblock, make sure to replacecmd.exefor the command that you want to run. If you need to run a complex command, we recommendcreating a scriptand running it with a single command inside Sandbox.

After you complete the steps, the system will run the commands or scripts you specified during the sign-in process.

How to map host folder on Windows Sandbox

To share a local folder from Windows 11 with the Sandbox desktop, use these steps:

In the script, make sure to specify the path for the host folder that you want to appear inside Windows Sandbox within theHostFolderblock. Also, inside theReadOnlyblock, use the “true” value (recommended) to enforce accessing the folder in read-only mode or use the “false” value to allow read-and-write access to the folder.

Once you complete the steps, when you start the Windows Sandbox from the configuration file, the virtual machine will mount the folder and make it available from the desktop.

Although the above instructions show you how to map only one folder, you can create multiple XML"MappedFolder"blocks inside the"MappedFolders"block to mount as many folders as you need.

How to manage virtual network adapter on Windows Sandbox

To manage the virtual network adapter through a configuration file on Windows Sandbox, use these steps:

Once you complete the steps, running the .wsb file will spin the virtualization environment with the configuration specified in the file.

How to manage virtual graphics on Windows Sandbox

To manage the virtual graphics adapter from the .wsb file, use these steps:

After you complete the steps, the virtualization environment will enable or disable the graphics adapter, depending on your configuration. If you disable the virtual GPU, this will result in performance degradation.

How to configure memory usage for Windows Sandbox

To change the amount of memory for the lightweight virtual machine, use these steps:

In the syntax, change 8192 (representing 8GB of RAM) for the amount you want to assign to the feature.

Once you complete the steps, the Sandbox will boot with the amount of memory you specified.

How to share audio devices on Windows Sandbox

To share audio devices like a microphone with the Sandbox, use these steps:

After you complete the steps, you will be able to connect the microphone to the Sandbox to test the application in question.

How to share video devices on Windows Sandbox

To share videos devices like a webcam with the Sandbox, use these steps:

Once you complete the steps, you will be able to connect, for example, a webcam to the Sandbox to test a specific application.

How to increase security between the host and Windows Sandbox

To increase the security between the host computer and Windows Sandbox through the remote desktop connection, use these steps:

After you complete the steps, the Windows Sandbox will operate in “Protected Client” mode, which includes extra security mitigation to decrease the chances of attacks through the RPD protocol.

How to control multiple options on Windows Sandbox

To use the Windows Sandbox feature with multiple options on Windows 11, use these steps:

Once you complete the steps using these specific settings, the virtual machine will run without a connection to the internet, and the virtual graphics will be disabled in favor of the software rendering engine. In addition, the feature will run a script to map a folder to the desktop, redirect audio and video devices to the virtual machine, and apply additional mitigations to increase security.

If you stumble upon issues, double-check the syntaxes in the configuration file to ensure that you use the proper casing. For instance, instead of"Disable,“try to use"disable"to see if that fixes the problem.

In addition to the settings outlined in this guide, Windows Sandbox supports other features, including printer redirection with the"PrinterRedirection"option and clipboard redirection with the"ClipboardRedirection"option.

More resources

For more helpful articles, coverage, and answers to common questions about Windows 10 and Windows 11, visit the following resources:

Mauro Huculak has been a Windows How-To Expert contributor for WindowsCentral.com for nearly a decade and has over 15 years of experience writing comprehensive guides. He also has an IT background and has achieved different professional certifications from Microsoft, Cisco, VMware, and CompTIA. He has been recognized as a Microsoft MVP for many years.