Play in Your Sandbox Again

Growing up, sandboxes were a great place to play. Microsoft built Windows Sandbox to do the same types of things in our new digital playground of computers and Windows.

Play in Your Sandbox Again
Photo by Ostap Senyuk / Unsplash

Growing up, sandboxes were a great place to play.  You could build things, and shape them the way you wanted, but the next time you came back it was all gone and you could do it again. Microsoft built Windows Sandbox to do the same types of things in our new digital playground of computers and Windows.  

Like many developers, I have many applications installed on my desktop and laptop.  I have things that I have tried once and then forgotten about and many of the applications are versions that are out of date.  There are many ways to fix this and help you to organize the applications that you have.  When you have too many programs starting on your computer, it will slow down your startup and use resources that could be used for something else.  There are many ways to resolve this, such as using Docker for things like running a database instead of getting it installed like normal.  You can then start/stop Docker whenever you need it and keep resources free.  Other virtual machine systems, like VMWare, Hyper-V, and others could do the same thing, but I would like to talk about a feature that is built into Windows called Windows Sandbox.

Windows Sandbox is a virtual machine that allows you access to your network and you can install anything in it that you want.  The interesting thing that is slightly different is that Windows Sandbox does not save the state of your virtual machine when it is shut down.  It is a clean system with only Windows installed.

Examples of Using a Sandbox

Now there are people who might question why you would want to have a clean system every time you restart your Sandbox.  There are a few examples as to where you can use this feature of Windows and it is something that can be used by software testers, developers, content creators, and others.

I used to work for a medical device company and every morning our awesome tester that we had in our office would reset the test machines using Norton Ghost back to a clean system. This allowed her to install the build that was created overnight on a clean system. This way it did not have any remnants of the previous software in the registry or on the hard drive that could give her bad results. The Sandbox would be a great feature for her since it would be clean instantly instead of taking around 30-45 minutes to get set up each day for each project she tested.

When I worked at Microsoft as a Senior Technical Evangelist, part of the job was to install the latest software and be able to demonstrate it, and be able to talk about it.  This was pretty much required of all of us, so I have been used to being in the Windows Insiders program, and other things to get and use beta versions of software.  However, sometimes the beta version of some software, such as Visual Studio might leave you in a state where your normal projects do not work anymore. The new version will probably become the default version of IDE or default .NET that is used.  This can be dangerous when you are trying to get a product out the door but still want to be able to try out the new software before it is released.  Windows Sandbox is great for this.  I have had to uninstall and reinstall too many beta and previous versions of software because of things like this.  Many of us live on that bleeding edge of software development but cannot really afford to crash our dev machine for days because of the new beta things.  Any virtual machine system would help with this problem as well (and might even be better at it).

Another great use of Windows Sandbox is for system protection. We all have gotten that link in our emails to go to a website that we are not sure about. With the Windows Sandbox, if you go to a website that you are not sure about and it installs a virus on your system, it is just in the Sandbox and a simple restart of the Sandbox removes it all. The browser that is built in is Edge, but if you really wanted to you could download Chrome or some other. Just do not expect it to be there if you reboot the machine.

One final example of a use of Sandbox is for content creators.  Using a clean system for demonstrating some software means that you don’t have to clean up your normal desktop.  You can put all of the files on it that you need and run everything from that virtual version of Windows.

Setting Up the Sandbox

Installing Windows Sandbox is a simple thing to do but also has some limitations.  First of all, the Windows Sandbox is not available on Windows Home.  You have to have Windows Professional, Education, or Enterprise installed to just get to install the Windows Sandbox.  Once you are set up in the Sandbox, you cannot get to a thumb drive, so making a thumb drive to put everything you want on the Sandbox is not going to work.  There also is no Windows Update in the Sandbox.  

You can however still get to network resources and the internet.  There is a network bridge installed that will allow these things to work.  You can log in with an online Windows Account, but it makes a local user for you instead by default.

Knowing these limitations, installing and launching the Sandbox is not very hard.  Open Settings and then search for "Windows features" and select the option for "Turn Windows features on or off".  This will bring up a dialog box that has many features listed such as Hyper-V, Windows Subsystem for Linux, and our new friend, Windows Sandbox.  Turn the checkbox next to Windows Sandbox on and it will install everything that it needs to run the Sandbox.  It will probably tell you to reboot before it is available.

Knowing these limitations, installing and launching the Sandbox is not very hard. Open Settings and then search for "Windows features" and select the option for "Turn Windows features on or off". This will bring up a dialog box that has many features listed such as Hyper-V, Windows Subsystem for Linux, and our new friend, Windows Sandbox. Turn the checkbox next to Windows Sandbox on and it will install everything that it needs to run the Sandbox. It will probably tell you to reboot before it is available.

After a possible reboot, you will have the Sandbox installed and ready to go.  Just search for Sandbox in your Start Menu and you can then launch a clean build of Windows.  When you shut it down it will tell you that it is not going to save anything and let you cancel the shutting down of the Sandbox.

So have fun with this simple virtual machine, protect yourself from bad links, test your code, and more in the Sandbox.  It was smart for Microsoft to add this as a feature for Windows so that we professional developers can have a safe place to do things.  I used to write drivers for Windows and if you mess those up, your entire system can get into a really bad state.  This would have helped me out and saved many hours of frustration.