Hey, Scripting Guy! How Can I Retrieve the Subject Property for a .MSI File?

Hey, Scripting Guy! How Can I Retrieve the Subject Property for a .MSI File?

  • Comments 3
  • Likes

Hey, Scripting Guy! Question

Hey, Scripting Guy! How can I retrieve the Subject property for a .MSI file?

-- J L-G

SpacerHey, Scripting Guy! AnswerScript Center

Hey, J L-G. Before you ask, the Scripting Guy who writes this column has no comment on the January 8th Florida-Ohio State football game. That’s primarily because this Scripting Guy refuses to recognize the “Bowl Championship Series” as being anything other than a bunch of football games. National championship? Not without a playoff; no way. (And had there been a playoff, USC would likely have won it all, as painful as that is to admit.)

Besides, the Scripting Guy who writes this column doesn’t like either Florida or Ohio State; he only watched the game because, well, what else are you supposed to do in the evenings?

What’s that? Read a book, do household chores, spend quality time with the family? Hey, we’re supposed to be the comedians around here!

Note. For those of you keeping track, yes, just yesterday the Scripting Guy who writes this column noted that he didn’t like the Dallas Cowboys. And yes, he’s also pointed out that he doesn’t like the Oakland Raiders. And – well, to simplify matters, let’s put it this way: other than the Washington Huskies and (usually) the Seattle Seahawks and the Seattle Mariners, the Scripting Guy who writes this column doesn’t like anybody or anything.

And if the Mariners continue to shell out millions of dollars to relief pitchers who go 1-2 with an 8.68 ERA, well ….

Of course, if we aren’t going to talk about college football then what can we talk about? Retrieving the Subject property for a .MSI file? Well, sure, we can do that. But we have to warn you, there really isn’t much to talk about:

Set objInstaller = CreateObject("WindowsInstaller.Installer") 
Set objProduct = objInstaller.SummaryInformation("C:\Scripts\FP11.MSI")

Wscript.Echo "Subject: " & objProduct.Property(3)

Like we said, there isn’t much to discuss here. We start out by creating an instance of the WindowsInstaller.Installer object; that’s an object that can bind to – and retrieve information from –.MSI files. We then use this line of code to grab all the SummaryInformation values for the file C:\Scripts\FP11.MSI:

Set objProduct = objInstaller.SummaryInformation("C:\Scripts\FP11.MSI")

After that we simply echo back the value of property 3, which just happens to be the value of the Subject property:

Wscript.Echo "Subject: " & objProduct.Property(3)

That’s going to give us output similar to this:

Subject: Microsoft Office FrontPage 2003

Pretty slick, huh?

And sure, you can retrieve other types of summary information using the WindowsInstaller.Installer object. In fact, you can retrieve all these summary information values:

Set objInstaller = CreateObject("WindowsInstaller.Installer") 
Set objProduct = objInstaller.SummaryInformation("C:\Scripts\FP11.MSI")

Wscript.Echo "Code page: " &objProduct.Property(1)
Wscript.Echo "Title: " & objProduct.Property(2)
Wscript.Echo "Subject: " & objProduct.Property(3)
Wscript.Echo "Author: " & objProduct.Property(4)
Wscript.Echo "Keywords: " & objProduct.Property(5)
Wscript.Echo "Comment: " & objProduct.Property(6)
Wscript.Echo "Template: " & objProduct.Property(7)
Wscript.Echo "Last Author: " & objProduct.Property(8)
Wscript.Echo "Revision number: " & objProduct.Property(9)
Wscript.Echo "Edit Time: " & objProduct.Property(10)
Wscript.Echo "Last Printed: " & objProduct.Property(11)
Wscript.Echo "Creation Date: " & objProduct.Property(12)
Wscript.Echo "Last Saved: " & objProduct.Property(13)
Wscript.Echo "Page Count: " & objProduct.Property(14)
Wscript.Echo "Word Count: " & objProduct.Property(15)
Wscript.Echo "Character Count: " & objProduct.Property(16)
Wscript.Echo "Application Name: " & objProduct.Property(18)
Wscript.Echo "Security: " & objProduct.Property(19)
Two things we should note. First, this only works for .MSI files; you can’t use same script to retrieve summary information for, say, a .JPG file. (So how can you retrieve summary information for a .JPG file? Well, here’s one way.)
Second, some of these property names are misleading; for example, Word Count actually refers to the type of source image file you’re dealing with, and has nothing to do with the number of words in the .MSI file. For more information,
take a peek at the Windows Installer Reference documentation on MSDN.

Oh, and one more thing: this object works only on the local computer. For better or worse, you can’t create a remote instance of WindowsInstaller.Installer.

Now, where were we? Oh, yes. To be honest, the Florida-Ohio State game was pretty dull; there was a flurry of action early on, but after that Ohio State all-but disappeared. From then on the only excitement for the evening occurred, at least for those of us in the Seattle area, when commercials for one of the local news channel aired. “LOWLAND SNOW!!!!! GUSTS OF WINDS TOPPING 40 MILES AN HOUR!!!! BITTER ARCTIC COLD!!!!! WE’RE ALL GOING TO DIE!!!!!”

Holy smokes; are we headed for the Apocalypse or what?

As it turns out, the Seattle area could get some high winds, though nothing like the sustained windstorm of a few weeks ago. And, after the wind dies down, we might get a little snow, though, then again, we might not. As for bitter, arctic cold? Well, that part is true, as long as you consider highs in the 30s and lows in the mid 20s as being “bitter arctic cold.” Let’s just hope that the Seattle area never gets hit by a real emergency. After all, instead of being the voice of calm and reason our local news channels will probably encourage everyone to riot in the streets and to loot all the local stores. “IT’S EVERY MAN FOR HIMSELF!!!!! KILL OR BE KILLED!!!!! EVERYONE START PANICKING RIGHT NOW!!!!!”

On the bright side, though, having previously hosted the World Trade Organization Ministerial Conference, well, rioting and looting is one thing we Seattleites are prepared for.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • how can we retreive product name?

  • * Product code

  • can anyone pls share how to find product code of a msi using vb scripting?