Powered By Blogger

Wednesday, August 6, 2014

Customized Logs for msi

For writing customized Logging in default msi logs.
You can implement this using either a vb script or an installscript.
Below is a sample log which I created in between creating IIS WEBSITE and APP using APPCMD.

MSI (s) (A0:98) [11:02:47:417]: Hello, I'm your 32bit Impersonated custom action server.
Action start 11:02:47: callthis.
Custom Log: 7/11/2014 11:02:47 AM : Creating Site TestThisSite...
Custom Log: 7/11/2014 11:02:51 AM : Creating App WebUI under Site TestThisSite...
MSI (s) (A0:6C) [11:02:51:472]: Doing action: FindRelatedProducts
Action ended 11:02:51: callthis. Return value 0.

All you want to do is to include the below Function in your code.

InfoMessage “Here is my log”

Sub InfoMessage (MsgText)
            Const msiMessageTypeInfo = &H04000000
            Set oRec = session.Installer.createRecord(1)
            oRec.StringData(0) = "Custom Log: " & Now() & " : [1]"
            oRec.StringData(1) = MsgText
            Session.Message msiMessageTypeInfo, oRec
            Set oRec = Nothing
End Sub

No comments: