MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Per-Machine Installations with some Per-User Resources[Next]: HKLM Run Key
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Windows Installer FAQ (the basics)->Installation Types (per-user or per-machine)->Per-Machine Installations with some Per-User Resources->Active Setup

Active Setup

It appears to be a handy way of getting something to run once per-user and could be useful if you don't have any shortcuts or other advertising mechanisms in your package.

There seem to be a number of variations on what is possible but the following registry extract is a good example:

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{22d6f312-b0f6-11d0-94ab-0080c74c7e95}]
              @="Microsoft Windows Media Player 6.4"
  "ComponentID"="mediaplayer_W2K"
  "IsInstalled"=dword:00000001
      "DontAsk"=dword:00000002
       "Locale"="EN"
     "StubPath"="rundll32.exe advpack.dll,LaunchINFSection C:\\WINNT\\INF\\mplayer2.inf,PerUserStub.NT"
      "Version"="6,4,9,1109"

The part in "bold" is any unique key for that box, a GUID is one way of making sure its unique. The 2 "red" values are the most important, the "StubPath" is the Executable and its command line and the "Version" should be set to a new value if the command ever needs to be re-executed.

For other active setup information see:

Example - My Test

The following shows an attempt at a solution for getting user information "repaired" when the user logs on (rather than repaired via advertised shortcuts etc). You may want to use other "MSIEXEC.EXE" switches...

There are two problems with this approach:

  1. The "Active Setup" code does not care whether or not the command works and so will only ever run it once.

  2. The original MSI package needs to be available.
#define ActiveSetupKey SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]
<$Component "ActiveSetup" Create="Y" Directory_="INSTALLDIR">
   #(

       <$Registry
                  HKEY="LOCAL_MACHINE"
                   Key="<$ActiveSetupKey>"
                 Value="TESTMSI"
          MsiFormatted="KEY"
       >
   #)
   #(

       <$Registry
                  HKEY="LOCAL_MACHINE"
                   Key="<$ActiveSetupKey>"
                  Name='Version'
                 Value="1"
          MsiFormatted="KEY"
       >
   #)
   #(

       <$Registry
                  HKEY="LOCAL_MACHINE"
                   Key="<$ActiveSetupKey>"
                  Name='StubPath'
                 Value="msiexec.exe /f [ProductCode]"
          MsiFormatted="KEY,VALUE"
               KeyPath="Y"
       >
   #)
<$/Component>


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Per-Machine Installations with some Per-User Resources[Next]: HKLM Run Key


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday December 09 2017 at 9:30am
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.