PowerShell 5.0

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 syntaxis to use to extract files from an .msi file (MSI package), so here is a short post with the command.

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

msiexec.exe /a C:\Users\user\path\to\file.msi /qb TARGETDIR=C:\Users\users\tempCode language: PowerShell (powershell)

A more PowerShell way is to:

  -NoNewWindow msiexec.exe
  -ArgumentList "/a C:\Users\user\path\to\file.msi /qb TARGETDIR=C:\Users\users\temp"
Code language: PowerShell (powershell)

Make sure you type out full paths and the destination directory must exist.

Msiexec.exe command arguments used:

  • /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 (when the user runs Setup.exe or MsiExec.exe with the /a command-line switch).

7-Zip can also be used to extract .msi files (read in Dutch β€œ7-Zip installerenβ€œ)

Jan Reilink

Hi, my name is Jan. I am not a hacker, coder, developer or guru. I am merely an application manager / systems administrator, doing my daily thing at Embrace - The Human Cloud. In the past I worked for clidn and Vevida. With over 20 years of experience, my specialties include Windows Server, IIS, Linux (CentOS, Debian), security, PHP, websites & optimization. I blog at https://www.saotn.org.