1

I build my own MSI from wsx code. When I run it with command

msiexec /i "test.msi" /quiet /norestart /qn /log "test.log"

I have log file like that

Action start 10:19:28: INSTALL.
Action start 10:19:28: FindRelatedProducts.
Action ended 10:19:28: FindRelatedProducts. Return value 1.
Action start 10:19:28: SaveCmdLineValueINSTALLDIR.
Action ended 10:19:28: SaveCmdLineValueINSTALLDIR. Return value 1.
Action start 10:19:28: AppSearch.

Date and Time in log file is local, but I need UTC format. Are there any solution?

1 Answers1

0

I had a quick look and investigated the log for 1) timestamps C style (no obvious ones) (how to interpret an MSI log), 2) the use of debugging logging also did not add much useful, then there is the issue of 3) system policies - maybe they can report all times in UTC? Not sure. Didn't find anything obvious. Times in the 4) event viewer seem to be local time, but you might be able to access it to get UTC versions.

What you definitely can do is to 5) use a custom action to write UTC time yourself directly into the start of the log. Would that help? (UTC Time VBScript).

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_UTCTime")

For Each objItem in colItems
  Msgbox "UTC Time: " + CStr(objItem.Hour) + CStr(":") + CStr(objItem.Minute) + CStr(":") + CStr(objItem.Second)
Next

Custom Action Snippets: Numerous constructs required in WiX source file to run VBScript custom actions:

<Binary Id='UTC.vbs' SourceFile='UTC.vbs' />
<CustomAction Id='UTC.vbs' VBScriptCall='' BinaryKey='UTC.vbs' Execute='immediate' Return='ignore'/>

<InstallExecuteSequence>
    <Custom Action='UTC.vbs' Sequence='1' />
</InstallExecuteSequence>

Write to Log: How to write to the MSI log file. The code required to write to the log file in terse form:

Const msiMessageTypeInfo = &H04000000
Set msgrec = Installer.CreateRecord(1) 
msgrec.StringData(0) = "Log: [1]"
msgrec.StringData(1) = "write this to log"
Session.Message msiMessageTypeInfo, msgrec 

Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164