How to Extract the Contents of MSI, MSIX, and EXE Installation Packages
Back in the days of Windows XP and the early stages of application repackaging for enterprise needs, quality assurance teams often needed to verify that the repackaged MSI package had the same structure as the original installation package.
While installing both packages and comparing the installation folders may seem like a solution, it’s inefficient and time-consuming.
If you think about it, the solution might be even easier and doesn’t require any actual installation of the package, and that is to extract the contents of the MSI installation package and compare it with the repackaged output.
Additionally, extracting package contents can be useful for other tasks, especially with the newer MSIX package format.
Let’s have a look at this article on how you can extract the contents of MSI, MSIX, and EXE installation packages.
Extracting MSI Package Contents
When it comes to MSI packages, tools like 7-zip are commonly recommended.
If we open the Advanced Installer MSI with 7-Zip, we will see there are the actual MSI tables, rather than the intended file structure.
While you might find the .cab file containing all the files, this will only extract the raw files, without preserving the folder hierarchy.
The Correct Way: Using msiexec
To extract the full contents of an MSI package, you can use this msiexec command:
msiexec /a "C:\path\to\your\file.msi" /qb TARGETDIR="C:\path\to\extract\folder"
This command extracts all files from the MSI package to the specified directory.
Extracting MSIX Package Contents
Unlike MSI, the MSIX format doesn’t store its file and folder structure inside a database.
This makes it much easier because you can use 7-zip to view and extract your MSIX package.
Additionally, if 7-zip is not the tool of your choice you can use the MakeAppx.exe (App Packager) which is included in Microsoft Visual Studio and the Windows Software Development Kit (SDK) for Windows 8 or Windows Software Development Kit (SDK) for Windows 8.1 and newer.
You can download the Windows SDK from here.
Once the SDK has been downloaded and installed, you can use the following command line to extract your MSIX/UWP/APPX package contents:
MakeAppx.exe unpack /p "C:\path\to\your\package.msix" /d "C:\path\to\extract\folder"
Once MakeAppx finishes, the designated output folder will reflect the actual contents of the MSIX:
Extracting EXE Package Contents
Extracting EXE installers is more complex because they can be created with various tools on the market.
You can have a look at this blog post where I explained how a self-extracting EXE can be created with 7Zip and it acts like an installer.
Additionally, EXE installers don’t follow any pattern rules, or best practices which means there is no universal method for extracting EXE contents.
Option 1: Using 7-zip
7-Zip can sometimes extract EXE files, but it doesn’t work for all installers. Have a look at this example of Tableau Reader. If we open it up with 7Zip, you will see this:
Tableau Reader is created with WiX and I've written a separate article on how to extract the MSI directly from the EXE file. You can check it out here.
Option2: Using UniExtract 2
If 7-zip fails, you can try UniExtract 2 (or Universal Extractor 2), a free tool designed to extract files from various package formats. You can download it from GitHub.
Once you’ve downloaded, extracted, and run the UniExtract.exe, you will be presented with a simple interface that just asks you about the target extraction file and the place where to be extracted:
We tested this method with Tableau Reader, and it successfully extracted the MSI file and its prerequisites.
Conclusion
Extracting the contents of installation packages can save time and simplify tasks such as quality assurance and troubleshooting.
Here’s a quick summary of the methods covered:
- MSI: Use msiexec for a proper extraction with the correct file structure.
- MSIX: Use 7-Zip or MakeAppx.exe for a straightforward extraction.
- EXE: Use 7-Zip as a first attempt, and if that fails, try Universal Extractor 2.
By following these techniques, you can efficiently access and analyze the contents of MSI, MSIX, and EXE packages for your projects.
If you found this helpful, subscribe to our newsletter to get the latest tips, tutorials, and updates straight to your inbox.