MX4399
MX4399

Reputation: 1519

How to log the installation date to the registry

When an install completes successfully, the date and time and some other info needs to be written to the registry. How can a date be generated and how do you know if an install was completed successfully? (writing to the registry with wix is not a problem).

Upvotes: 9

Views: 5053

Answers (3)

Rikin Patel
Rikin Patel

Reputation: 9383

For both date and time here is some sample code.

<RegistryValue Id="InstallDateTime"
               KeyPath="yes"
               Name="InstallDateTime"
               Value='[Date] [Time]'
               Type="string" />

enter image description here

If you want to use separator you can simply add it as text like:

<RegistryValue Id="InstallDateTime"
               KeyPath="yes"
               Name="InstallDateTime"
               Value='[Date]-[Time]'
               Type="string" />

enter image description here

Upvotes: 9

Yan Sklyarenko
Yan Sklyarenko

Reputation: 32240

What about using standard MSI properties Date and Time?

Note: Be warned that despite the documentation indicating the date will always be in the MM/DD/YYYY format, this is not in fact the case. A verbose MSI log on my system (in Australia) shows the property in DD/MM/YYYY format... e.g.:

Property(S): Date = 21/04/2010

Upvotes: 10

TheCodeArtist
TheCodeArtist

Reputation: 22477

Env variables??


Can you access environment variables like PATH etc. ??

  • These return the current system date and time...

    You might want to access %DATE% & %TIME%

Alternately, since You are able to access the Registry, You can access the Env vars in the registry itself:

HKEY_CURRENT_USER\Environment\<variable>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\<variable>

GoodLUCK!!

Upvotes: 0

Related Questions