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 » 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.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Share via
Copy link