Monday, November 17, 2008

Logging switches

To be overwhelmed by information about what an MSI installer is doing, run the following from a command prompt:

msiexec /i ProductName.msi /L*v everything.log

In particular, the *v following the /L switch specifies to do verbose logging of everything the installer does.

Trouble is—which you know because I telegraphed the punchline—it’s often way more than you wanted. The MSI help topic “Command-Line Options” (or running msiexec /?) lists other, more specific switches that can follow /L. In particular, you can log just the properties like this:

msiexec /i product.msi /Lp properties.log

The output has just entries like this:

=== Logging started: 0/0/0000  00:00:00 ===
Property(S): DiskPrompt = [1]
Property(S): ProductToBeRegistered = 1
... many more ...
Property(C): DiskPrompt = [1]
Property(C): ALLUSERS = 1
Property(C): PrimaryVolumeSpaceRemaining = 0
Property(C): PrimaryVolumeSpaceRequired = 0
... etc. ...
=== Logging stopped: 0/0/0000 00:00:00 ===

Pop quiz: why do the client (C) properties appear after the server (S) properties?

And a tip: to see what properties changed or appeared between the (C) and (S) sides, run a command like this:

sort /+13 properties.log

The output looks something like this:

Property(S): ADDLOCAL = FeatureName
Property(S): AdminToolsFolder = C:\Documents and Settings\All Users\Start Menu\
Programs\Administrative Tools\
Property(C): AdminToolsFolder = C:\Documents and Settings\username\Start Menu\
Programs\Administrative Tools\
Property(S): AdminUser = 1
Property(C): AdminUser = 1

…and so on.

Similarly, to display just information about action starts, stops, and return values, use /Li. The log starts something like this:

=== Logging started: 0/0/0000  00:00:00 ===
Action start 00:00:00: INSTALL.
Action start 00:00:00: AppSearch.
Action ended 00:00:00: AppSearch. Return value 0.
Action start 00:00:00: LaunchConditions.
Action ended 00:00:00: LaunchConditions. Return value 0.
Action start 00:00:00: FindRelatedProducts.
Action ended 00:00:00: FindRelatedProducts. Return value 0.
Action start 00:00:00: ValidateProductID.
Action ended 00:00:00: ValidateProductID. Return value 1.
Action start 00:00:00: CostInitialize.
Action ended 00:00:00: CostInitialize. Return value 1.
... etc. ...

The MSI help topic “Logging of Action Return Values” describes what these return values mean.

I have no idea what the c and u switches do.

No comments: