Posts Tagged ‘ActiveSetup’

I’ve written before about the usefulness of ActiveSetup, but today am here to warn you about a pitfall of using ActiveSetup.

When working with roaming profiles, depending on how your environment is configured, the HKCU registry hive will also roam with users. This is fine if your active setup action is a profile related thing (perhaps create a file in their profile, run a script to move something in their profile). However, if it’s not (maybe creating a local AppData file or something else local), ActiveSetup will work fine the first time, but won’t re-run for the user when they logon to another computer. This could break what you were trying to do.

So, some final words: take care with ActiveSetup, it may not be the tool for your job. An alternative could be the Run key (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run) or RunOnce (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce)

Read Full Post »

Active Setup is a useful tool to install per-user files and registry settings when you don’t have anything else on the computer to act as an entry point. How it works is fairly simple:

  1. Create a registry key in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components – call it MyApp. It will be easier to distinguish if you use a name rather than a GUID.
  2. Create a string value called ComponentID, put in MyApp
  3. Create a string value called StubPath, put in the command you want to run. Some examples could be msiexec…, cscript…, setup.exe, myapp.exe etc.
  4. Create a string value called Version, put in 1

Now, every time a user logs in to that computer, Windows will check if HKEY_CURRENT_USER\SOFTWARE\Microsoft\Active Setup\Installed Components\MyApp exists.

If it doesn’t exist, it will execute the command in StubPath under the user’s context, then create HKEY_CURRENT_USER\SOFTWARE\Microsoft\Active Setup\Installed Components\MyApp. If it does exist, it will check the version and if equal or greater will do nothing.

This doco from Ed Tippelt contains a bit more detail. With any luck, I’ll put together a vbscript to illustrate this further. [EDIT] Here’s the script:

Set objShell = WScript.CreateObject(”WScript.Shell”)
appName = “MyApp”
ActiveSetupSource = “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\” & appName & “\”
objShell.RegWrite  ActiveSetupSource & “(Default)” , appName & ” Install”
objShell.RegWrite  ActiveSetupSource & “ComponentID” , appName
objShell.RegWrite  ActiveSetupSource & “StubPath” , “msiexec c:\Data\myapp.msi”
objShell.RegWrite  ActiveSetupSource & “Version” , “1″

Read Full Post »