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 package from this post.
Related Post – How to Make Application Packagers Life Easier
Windows Sandbox is a feature introduced by Microsoft in Windows 10 version 1903 that leverages Windows Containers in order to quickly and easily set up a disposable virtual machine to use 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 for capturing legacy installers to MSI as well as testing existing packages and the lack of setup required greatly speeds up the process of getting started compared to using traditional VMs!
Enabling Windows Sandbox
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:
- 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 an 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 security policy.
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, simply start the program as usual and select the Virtual machine option as the capture source:
- Press next and select to use Windows Sandbox in the list of virtual machines:
- Press next and configure any options for creating the 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:
- After this press Execute to run the installation in the sandbox and go through the installation as normal:
- 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:
- 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:
- Pressing next again starts the process to build the package. This includes copying the necessary files out of the sandbox.
- 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:
- 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/