Monday, March 14, 2005

Extracting files from MSI

I wanted to be able to extract files directly out of an MSI file. Sometimes, I simply do not want to power up the correct OS version or install a product just to get to the files within. I tried doing it with ORCA (from the platform SDK) – but couldn’t figure it out. I also tried some of the other platform SDK msi*.exe tools – again without luck. Maybe someone can tell me how? Next I tried to investigate whether the MSI could be accessed by SQL. Again, I failed to find the necessary information. Finally, I got it. I looked at the Project Windows Installer XML (WiX) toolset. I downloaded the wix i386 binaries and extracted the ZIP file. Then I ran –
Dark.exe file.MSI file.XML /x .
The result of this conversion (file.XML) and extraction (/x) is a file.XML (which I have no use for) and the binary files contained within the MSI file.
Thanks to the people working with WiX.

11 comments:

ewall said...

A couple options:

The quick, chunky way is to do create an admin installation to a temp directory, which will extract all the files for the program (which you can delete after you get the one you need, of course): msiexec /a target.msi

More direct but a lor more complicated, you can use MSIDB.EXE from the Windows Installer SDK to extract a specific data stream from the MSI file. To find out the name of the data stream, you'll have to look in the "Media" table (use Orca, or export the table with MSIDB if you really want). If the MSI compresses the files, it'll only list one or more CAB files. If there are multiple CABs, you may need to figure out which one has the file you want by looking in the "File" table for the "Sequence" number: the "Media" table has "LastSequence" entries for each CAB file. Anyway, the syntax to extract the CAB is msidb -d "target.msi" -x "Data1.cab"

Hope that helps you out!

FlohEinstein said...

That was one hell of a tip! Thanks a lot, I've been searching for a tool like this for a long time...
Should make it easier to make Windows installation discs with integrated software...

Anonymous said...

Use Orca to view the "Cabs" table. You should see a list of the embedded cab files. Find the cab file you want and click on the [Binary Data] element. You will get an "Edit Binary Stream" dialog where you can write the binary data to a file. The resultant file is a cab file that can be manipulated the same as any .cab file.

Anonymous said...

I was lost for a second when the tool gave an error message. Then I noticed that there's a "dot" as the final argument in the example:

Dark.exe file.MSI file.XML /x .

Note the "." at the end, or you'll get an error message.

Anonymous said...

this one works great for me
http://www.tech-recipes.com/rx/2557/vista_how_to_extract_content_from_msi_files

Anonymous said...

Nice - just exactly the tip I was looking for - thanks ewall and NeoMaxGeek.

unRheal said...

Awesome, THANKS! :)

I was looking for an easy way to do it with some quick utility that did NOT involve MSIEXEC, as most people suggest. (msiexec /a ....)

Much appreciated! Cheers

Jeff Jones said...

Thank you! This trick worked perfectly for some MSI content I could see with Orca and needed to extract.

Tonya Henson said...

You can also go to open zip file to open your zip files easily online. Hope this is a big help.

WindowsPistha said...

It works. Thanks for info!

Muzi said...

thanks mate, this is exactly what i was looking for.