How would I have windows installer automatically create a log file without having the user type something at the command prompt? That is, I would like running the installation to be the same as typing to the following in the command prompt:
msiexec.exe /i mymsi.msi /l*v c:\temp\inst_log.log
Is there something I can add in my Visual Studio .NET setup project that will make the installation automatically create a log file just like that command?
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

2
The easiest way is to use the "Logging" policy.

But it's also possible to switch logging on from within your MSI using a custom action ("MsiEnableLog"). Here's a vbscript example of how:

Set oInst = Me.Installer
'Msgbox oInst.Version
oInst.EnableLog "v", "c:\temp\inst_log.log"

The most difficult issue is where to place your CA - it will not work otherwise. When I tried it, I placed it right at the start of the install (before "launchconditions" in the "InstallUISequence"). But this may not be suitable if you hide the user interface?

You can uncomment the second line for testing purposes (or omit it).

Good luck - and don't forget to rate the post if you like it (or hate it)!
Answered 02/28/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
I suppose I don't quite understand how the script works. Am I supposed to replace "Me" with something or is the script going to work as is?
Answered 02/28/2005 by: Galen
Senior Yellow Belt

Please log in to comment
2
It should work as it is - but I should probably have used "session" instead to avoid confusion. It's a very simple script (only two lines). The third line was only there to reassure you that the script was running and creating a valid "Installer" object.

Set oInst = Session.Installer
oInst.EnableLog "v", "c:\temp\inst_log.log"

You simply need to create a vbscript custom action and schedule it correctly. Try it right at the start of your install first (like I did) - just to convince yourself that it works.
Answered 02/28/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
0
The script only worked when I put it before "launchconditions" in the "InstallUISequence" table just likeyou said. Thanks for your help!
Answered 03/02/2005 by: Galen
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity