Sei sulla pagina 1di 2

ActiveSetup Implementation

If you are using Windows Installer for per-machine-based installations, it could be the case that your setup
contains components with user-related resources that have no entry-points to initiate the install-on-
demand/self healing function of MSI. This, of course, will mean that when deployed the package will not
install the user resources required to run the application properly.

But wait, don’t lose hope! In such a case you can use the Active Setup for a self healing on demand. It
needs just one registry key in your msi file.

This registry key can be assigned to any Component that installs per-machine resources or you can create
one component just for this key.

How it works:
The value in the StubPath key will be executed at a special time during which the Active Setup tasks are
running and no other Windows Installer processes are running in the background that could cause the repair
not to run (which would be the case if you attempted to run this command in the Run-Once registry key).
The command will thereby perform a repair for HKCU registry keys and missing files.
If this command runs successfully, it will create a registry key in HKCU and the command will not run again.
However, if you wish to trigger this command again, because of a small update, then use the Version Key
and increment its value each time you wish to run this command again when a user logs in.

Important Note:
Remember to use this command only if your setup does not contain any entry-point that would not allow the
repair on demand, because this repair will run when a user on the target workstation logs in after the
installation has been run. That means, even if the user doesn’t use the installed application, it will run the
repair. And as you may already know, those repairs can take some time depending on the workstation’s
hardware configuration and the size of the package.
Active Setup Registry Keys

Following Registries are to be included in package to load User


settings(either registries/files) so that by the time User
logs in his current user settings will be available on the machine.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed
Components\[ProductCode]]
"StubPath"="msiexec /fup {9A346205-EA92-4406-B1AB-50379DA3F057} /qn"
"Version"="1,0"

What is Active Setup


Active setup provides a solution when the aim is to deliver user based components when no
advertised entry points exist in an MSI package.
Most packages will contain some kind on entry point; commonly an advertised shortcut. When launching this
kind of shortcut Windows Installer will check the keypath of the component the shortcut belongs to and
verifies that the component is installed. If it is found to be missing Windows Install will kick off a repair.
This provides a great solution for installing current user data when the package is not installed in the user
context. It is also a very good reason why you should never mix machine and user data in the same feature.

On logon the following registry keys are compared:


HKLM\Software\Microsoft\Active Setup\Installed Components\<UID>
HKCU\Software\Microsoft\Active Setup\Installed Components\<UID>
<UID> has to unique; it is good practise to use a GUID.
If the HKCU key is not found the contents of the string value StubPath is executed. The HKLM
key is then copied to HKCU.
The executable in StubPath can be anything (a VBS script, a regsvr32.exe call, etc), but our aim,
in this example, is to deliver missing current user data from a previously installed MSI. To do
this we need to force the package to repair so Msiexec.exe will be used:
Msiexec.exe /fpu /qn
/f – Repair
/p – only if file is missing
/u – all required user-specific registry entries
If you choose to, the entire installation can be repaired:
Msiexec.exe /fomus /qn

[HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{44CCA842-CC51-


11CF-AAFA-00AA00B6015B}]
“Version”=”1”
“StubPath”=”Msiexec.exe /fpu {44CCA842-CC51-11CF-AAFA-00AA00B6015B}”
Where a version is included; StubPath will only execute if the version of HKCU is less than the
version of HKLM.
When a new user logs on Windows will find the HKCU active setup key missing, run
Msiexec.exe with the repair arguments from StubPath and copy the HKLM key to HKCU. Next
time this user logs in the repair won’t run as the key already exists in HKCU.
Categories:

Potrebbero piacerti anche