Extract files from an MSI package without installing it

Date posted: 2022-11-02
Last updated: 2026-11-21

Extract the files from an .msi package without installing it: one msiexec /a command, a PowerShell Start-Process version, and 7-Zip for single files.

In Windows you can extract the contents of an MSI package (.msi file) using the command-prompt or via a script. I keep forgetting the correct msiexec.exe syntax to use extracting files from .msi files... So here is a short post with the command-line syntax without installing.

Extract the files from an .msi package without installing it: use msiexec /a with TARGETDIR, or Start-Process in PowerShell scripts.

An MSI package (Microsoft Installer package) is a Windows-specific file format used to install, configure, and remove software. It is managed by the Windows Installer service (msiexec.exe), handling everything from file installation to registry changes, shortcuts, and rollback procedures. It is the Windows-native installer format and offers strong administration, customization, and system-integrity benefits, making it ideal for enterprise scenarios. Although it requires more effort to create and manage compared to simpler EXE installers.

To extract all files from a .msi file, use the following msiexec.exe command:

& C:\Windows\System32\msiexec.exe /a "file.msi" /qb TARGETDIR=C:\temp\extracted

Use full paths. msiexec creates the TARGETDIR folder if it doesn't exist yet. Here are the msiexec.exe command arguments used to extract files from MSI packages:

  • /a: Specifies administrative installation
  • /qb: Specifies there's a basic UI during the installation process.
  • TARGETDIR: Represents the installation directory for an InstallScript installation, or for an administrative Windows Installer based installation. This is when the user runs Setup.exe or MsiExec.exe with the /a command-line switch. Important: This folder should ideally be empty.

A more PowerShell way is to use Start-Process. It handles spaces in paths more gracefully and allows for the -Wait parameter, which is essential for automation scripts.

Start-Process `
  -NoNewWindow C:\Windows\System32\msiexec.exe `
  -ArgumentList "/a `"$pwd\temp\file.msi`" /qb TARGETDIR=`"$pwd\temp\Extracted`"" `
  -Wait

In PowerShell you may substitute your user directory with $pwd.

Extract an MSI from a setup.exe

Many installers are a setup.exe with one or more MSI packages inside. How you get them out depends on the tool that built the setup.exe. A WiX Burn bundle, like the .NET runtime installers, has a /layout option, but that doesn't help when the MSI packages are embedded in the exe: it only copies the exe itself.

What does work: install the bundle once, then copy the MSI files from C:\ProgramData\Package Cache. Copy them before you uninstall the bundle again, because uninstalling removes them from the cache. The cache also holds MSI files of other installed software, so pick the ones you need:

New-Item -ItemType Directory C:\temp\msi -Force | Out-Null
Start-Process .\windowsdesktop-runtime-10.0.15-win-x64.exe -ArgumentList '/install /quiet /norestart' -Wait
Get-ChildItem 'C:\ProgramData\Package Cache' -Recurse -Filter *.msi | Copy-Item -Destination C:\temp\msi

Then extract the files from such an MSI with the msiexec /a command above.

Tested on Windows 11 in Windows PowerShell 5.1.26100, with the .NET Desktop Runtime 10.0.15 installer.

You can also right-click any .msi file and select 7-Zip > Open Archive. This is often faster if you only need to grab a single file (like a .cab or a specific DLL) without "installing" the whole directory structure to a temp folder. Here is how to install 7-Zip silently. Using .NET Framework 4.5 you list files in a zip archive with PowerShell easily.

Once you've extracted your drivers or binaries, you can use them in a silent installation through WDS or MDT. Here is a quick comparison table between msiexec.exe and 7-Zip.

Comparison Table: msiexec vs. 7-Zip

This table helps you decide which tool to use for their specific task:

Featuremsiexec /a7-Zip / Archive Tool
Folder StructurePreserves original layoutOften dumps flat or into .cab folders
ValidationVerifies MSI integrityJust extracts what it sees
AutomationNative, scriptable with msiexecRequires 7-Zip CLI (7z.exe)
SpeedSlower (runs installer logic)Very fast (direct extraction)

Update 11-4-2026: How long will MSI packages still exist? Microsoft is deprecating the PowerShell MSI package beginning with PowerShell 7.7-preview.1. 🙁 I should start writing MSIX posts. See Managing MSIX with PowerShell or MSIX PowerShell Cmdlets for all relevant info and commands.

Summary

  • You can extract files from an MSI package using the command line or PowerShell.
  • Use the msiexec.exe command with specific arguments to extract all files: /a for administrative installation and /qb for basic UI.
  • Ensure the destination directory exists and specify TARGETDIR for the installation directory.
  • Alternatively, use 7-Zip to extract .msi files, providing an easier method for some users.
  • An MSI package is a structured installer format ideal for enterprise deployment, though it requires more management than EXE installers.

In this post I showed you how to extract files from an MSI package.

This post was most recently updated on .

QR code: scan to donate 5 euro via PayPalScan to donate €5 via PayPalI write these posts in my spare time, based on real problems from my day job as a sysadmin. If this one saved you some debugging time, a 5 euro donation via PayPal is much appreciated, or link to it from your own site. Thanks! 🙏

Leave a Comment