PowerShell 5.0 logo

Extract files from an MSI package

Windows has the ability to allow the MSI package (.msi file) contents to be extracted using the command line or via a script. I keep forgetting the correct msiexec.exe syntax to use to extract files from an .msi file (MSI package), so here is a short post with the command.

Home » Windows Server » Extract files from an MSI package

In Windows you can extract the contents of an MSI package (.msi file) using the command line or via a script. I keep forgetting the correct msiexec.exe syntax to use to extract 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’s 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

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

A more PowerShell way is to use Start-Process:

Start-Process `
  -NoNewWindow C:\Windows\System32\msiexec.exe `
  -ArgumentList "/a C:\Users\user\path\to\file.msi /qb TARGETDIR=C:\Users\users\temp" `
  -Wait

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.

You can also use 7-Zip to extract .msi files (read in Dutch “7-Zip installeren“).

An MSI package is the Windows-native installer format – a comprehensive, structured container for application deployment. It 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.

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

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.
Jan Reilink
Jan Reilink

In my day to day work, I’m a systems administrator – DevOps / SRE and applications manager at Embrace – The Human Cloud. At Embrace we develop, maintain and host social intranets for our clients. Provide digital services and make working more efficient within various sectors.

Read why we can use your help and support ❤️

Articles: 173