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 an .msi file (MSI package)… So here is a short post with the command-line syntax.
To extract all files from a .msi file, use the following msiexec.exe command and arguments.
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 C:\Users\user\path\to\file.msi /qb TARGETDIR=C:\Users\users\temp Make sure you type out full paths and the destination directory must exist. Here are the msiexec.exe command arguments used to extract files:
- /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.

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 and 7-Zip.
Comparison Table: msiexec vs. 7-Zip
This table helps you decide which tool to use for their specific task:
| Feature | msiexec /a | 7-Zip / Archive Tool |
| Folder Structure | Preserves original layout | Often dumps flat or into .cab folders |
| Validation | Verifies MSI integrity | Just extracts what it sees |
| Automation | Native, scriptable with msiexec | Requires 7-Zip CLI (7z.exe) |
| Speed | Slower (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.