How to Use Windows Sandbox to Create MSI Packages

Let’s see how to use Windows Sandbox to Create MSI Packages from Legacy Installers. You are going to see how Smart Package studio helps to build MSI packages from this post.

Related Post – How to Make Application Packagers Life Easier

Introduction

Windows Sandbox is a feature introduced by Microsoft in Windows 10 version 1903 that leverages Windows Containers to quickly and easily set up a disposable virtual machine for safely testing unknown executables and other purposes for which having a temporary machine is useful.

The feature is fully self-contained, and apart from enabling the feature in Windows 10, no configuration is necessary to use it.

Additionally, the image for the virtual machine is dynamically generated using a differential comparison to the host operating system’s files, which means that the amount of disk space required for Windows Sandbox is significantly smaller than for typical VMs.

Smart Package Studio has recently added support for using Windows Sandbox to capture legacy installers to MSI and test existing packages. The lack of setup required greatly speeds up the process of getting started compared to using traditional VMs!

Enabling Windows Sandbox for Windows 11 PCs

A few steps need to be performed to enable Windows Sandbox:

  • You must be running Windows 10 Professional or Enterprise 1903 or newer
  • Hardware virtualization must be enabled. If it is not currently enabled, this can generally be done in the BIOS

Start by enabling the Windows Sandbox Feature. This can be done in the Turn Windows features on or off dialog:

Adaptiva
Enable - Use Windows Sandbox to Create MSI Packages
Enable – Use Windows Sandbox to Create MSI Packages
  • Or by running the following command in an elevated command prompt:
  • DISM /online -Feature /FeatureName:”Containers-DisposableClientVM” /All
  • The machine needs to be restarted after activating the feature before it can be used.

Note: By default, Windows Sandbox requires accepting a UAC prompt when it starts. This can be avoided by adding your user account to the “Hyper-V Administrators” local security group and is recommended unless not allowed by the security policy.

Hyper-V administrators - Use Windows Sandbox to Create MSI Packages
Hyper-V administrators – Use Windows Sandbox to Create MSI Packages.

Using Windows Sandbox with Smart Package Studio

Smart Package Studio, as per version 4.54, supports using Windows Sandbox in the following ways:

  • In Smart Capture to capture legacy installers to create an MSI project
  • In Smart Tester to run a test installation of any installer in the sandbox

Apart from activating the Windows Sandbox feature, there are no steps necessary to use the sandbox with Smart Package Studio – it will simply appear as an option in the list of available virtual machines.

Using Smart Capture

To use Windows Sandbox with Smart Capture, start the program as usual and select the Virtual machine option as the capture source:

How to Use Windows Sandbox to Create MSI Packages 1

Press next and select to use Windows Sandbox in the list of virtual machines:

Use Windows Sandbox to Create MSI Packages
Use Windows Sandbox to Create MSI Packages

Press next and configure any options for creating the snapshot:

Create Snapshot
Create Snapshot

Pressing next will start up Windows Sandbox and start the process of creating an initial snapshot of the machine state.

Once this is completed, you can select the package you wish to install from the Smart Capture window, or simply drag the file to it:

How to Use Windows Sandbox to Create MSI Packages 2

After this press Execute to run the installation in the sandbox and go through the installation as normal:

installation in the sandbox
installation in the sandbox

Once the installation has completed and you have made any necessary configuration changes to the application in the sandbox, press Next in Smart Capture to create the second snapshot and compare them.

Once it is completed, you will be presented with the list of items that were detected in the capture and you can choose to exclude or include items:

Customize Included - Use Windows Sandbox to Create MSI Packages
Customize Included – Use Windows Sandbox to Create MSI Packages

Pressing next you are able to select if you want to create a new MSI project or add the changes to an existing MSI project or package and then set options for the generated package:

Use Windows Sandbox to Create MSI Packages
Use Windows Sandbox to Create MSI Packages

Pressing next again starts the process to build the package. This includes copying the necessary files out of the sandbox.

Use Windows Sandbox to Create MSI Packages
Use Windows Sandbox to Create MSI Packages

After the package has been saved you can choose to open the newly generated project in Smart Editor to compile it to an MSI package or edit it further, and also to shut down the sandbox if it is no longer needed:

Use Windows Sandbox to Create MSI Packages
Use Windows Sandbox to Create MSI Packages

Resources

  • Windows Sandbox introduction https://techcommunity.microsoft.com/t5/windows-kernel-internals/windows-sandbox/ba-p/301849
  • Windows Containers: https://docs.microsoft.com/en-us/virtualization/windowscontainers/about/
  • Smart Package Studio: https://smartpackagestudio.com/

Author

Anoop C Nair is Microsoft MVP! He is a Device Management Admin with more than 20 years of experience (calculation done in 2021) in IT. He is Blogger, Speaker, and Local User Group HTMD Community leader. His main focus is on Device Management technologies like SCCM 2012, Current Branch, and Intune. He writes about ConfigMgr, Windows 11, Windows 10, Azure AD, Microsoft Intune, Windows 365, AVD, etc.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.