Howto: extract files from a .msi file using the Windows command line


Every once in a while I need to extract the content of a .msi file in order to customize a deployment for a particular network environment. Sometimes initializing the .msi installer will temporarily extract the files into C:\Documents and Settings\<username>\Local Settings\Temp, but those files are removed once the installer exits.

To extract files from a .msi file at the command line, type:

msiexec /a PathToMSIFile /qb TARGETDIR=DirectoryToExtractTo

For example, to extract files from f:\zenworks\zfdagent.msi into c:\zfd701 you would type:

msiexec /a f:\zenworks\zfdagent.msi /qb TARGETDIR=c:\zfd701

The destination directory does not need to exist prior to running this command.

[update 05-20-2009]

I have a new favorite MSI extraction tool called LessMSIerables.  Check it out!

Posted in howto, zenworks. Tags: . 18 Comments »

18 Responses to “Howto: extract files from a .msi file using the Windows command line”

  1. Cyntek Says:

    Thanks for the info on How to extract .msi file in windows xp. It was very helpful and plus i did not have to download another utility in order to do so.

  2. nvirt Says:

    Bah, doesn’t work with msi files that INSIST on installing crap for all users when you are not an administrator.

  3. JAB_au Says:

    Very handy to know that. I needed to get a copy of RoboCopy out of the 2003 Resource Kit to use on a Windows 2000 machine. Did the job nicely for me.

  4. Andris Says:

    Thanks for sharing this. I just need to clarify that it’s important to specify the full path to the destination directory in TARGETDIR property. If your path is not fully qualified then the msiexec tries to connect to the server which name will be equal to the name you’ve specified.

  5. dk Says:

    It does NOT work on Wine 0.9.14, instead it shows tons of warnings and nothing happens….

    • winternight119 Says:

      Of course it’s not going to work in Wine, it’s not Windows, and not all of the resources for completing command line operations are there. Try VirtualBox.

      ~Night

  6. korser Says:

    I was tryning to extract Itune and it kept asking for administrator privilege. I think I found a way around the problem.

    If I use first /ju switch. msiexec is in user mode
    msiexec /ju PathToMSIFile TARGETDIR=DirectoryToExtractTo

    Then I can use to extract the file
    msiexec /a PathToMSIFile TARGETDIR=DirectoryToExtractTo

    From the doc
    /j [/t ] [/g ]
    Advertises a product – m to all users, u to current user

  7. NJK Says:

    Brilliant korser! works like a charm. Thanks.

  8. Charles Thayer Says:

    I use Ubuntu Linux, and I’ve found that installing p7zip and running “7z x .msi” works well. (see http://www.7-zip.org). Others have had success with wine and “msiexec”.

    Good luck,
    /charles thayer

  9. Neil Hunt Says:

    The next version of InstEd Plus (http://www.instedit.com/instedplus) will allow you to easily extract the files from an msi/msm into a source tree. Plus you get all the normal features of InstEd and InstEd Plus.

  10. Extracting MSI Files Locally to Avoid Install Says:

    […] quick Google search for “extracting msi files” revealed a really nice blog post Howto: extract files from a .msi file using the Windows command line . Go there and learn how to extract MSI files and then add them manually to a tools repository and […]

  11. Scott Willeke Says:

    FYI: I published an update to the LessMSIerables utility at http://code.google.com/p/lessmsi/

  12. James Bastion Says:

    Could be a nice utility but I have a particular use case that can’t be that hard to cater for. Here goes: I would like access to a the contents of an msi file that was hidden in an installshield.exe which wouldn’t install without IIS (unshield did the trick). I don’t run any Microsoft products and have taken a stance against allowing mono (dotnet) on any boxes I have control over. I hoped that the commandline option of lessmsi would give me just that but it reports dependency on dotnet.

    The msi file has documentation, java libraries and the like with generic application but for some reason the requirement of Microsoft products appears at every turn, this seems strange to me.

  13. How to get jQuery 1.4.1-vsdoc Says:

    […] Type this MS DOS command (referenced from this blog post), when it’s complete, close the command window: msiexec /a vs2008toolsmvc2.msi /qb […]

  14. Branislav Abadjimarinov Says:

    Thanks, that was a real lifesaver. It worked perfect with .msi file containing some files.

  15. meomando Says:

    It is great tool “Scott Willeke”

    thaaaaaaaaaaanks

  16. 0x Says:

    Good Guide – A few points I’d like to add.

    The instructions here, as well as the contributions given by various users, will allow you a great deal of flexibility with .MSI files

    For example:
    One may extract/Install an MSI application which USUALLY could not be installed with a NON-Administrator account (eg – a “limited” account”.

    I point to the users korser and Andris above. Andris reminds users to ensure the extract path is in the correct format- but more importantly, what I’d like to share is that point out the parameters suggested by korser.
    They will allow you to extract the contents of MSI files – circumventing the user privilege restrictions, HOWEVER, some MSI packages may not want to extract to a SUB-folder!
    They may require that you extract them to a root folder – such as on your local hard drive, OR an external thumb drive, etc.

    Just thought I would mention that ^_^

  17. renzo hernandez Says:

    hey there ..well i dont understand nothing of what you have said..but heres my problem ive been trying to install this program called steam ..some of you may know that program …well every time i hit the install button i keep on getting this error saying ERROR 1324 THE FOLDER PATH ‘PROGRAM FILES (X86)’ CONTAINS A INVALID CHARACTER AND IVE BEEN TRYING BUT I JUST CANT FIGURE OUT THE PROBLEM


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: