PDA

View Full Version : Registry Setting



AmberTiger
03-22-2007, 04:51 AM
Hi,

When installing my app I manually create a registry entry through InstallScript to the HKCU, which works fine. The problem I am having is when doing a per machine install - this registry setting does not appear for all users just under the user the app was first installed (Administrator) I am setting ALLUSERS=2.

How do you manually set a registry setting that is set for all users on a machine?

Thanks

LeslieEaster
03-22-2007, 04:17 PM
You have three choices:

1. Use an advertised shortcut to your application and install the product per machine. When the user uses the shortcut that will trigger an install of any components using user-specific keypaths--in this case you're registry keys.

2. Create a custom action that loads each user's HKCU hive and writes the necessary registry keys.

3. Add you install to the Active Setup registry key. This triggers a repair (if necessary) when the user logs on. You may want to play with the command line values a bit but this should get you going. Keep in mind that this assumes that the components use a per-user keypath--such as your HKCU registry key.

HKLM\Software\Microsoft\Active Setup\Installed Components\{Product Code}
VName = StubPath
VData = msiexec /fauvs {ProductCode} /qb

AmberTiger
03-23-2007, 07:11 AM
Thankyou for your reply Leslie.

I have read the options you gave and only options 2 and 3 seem to be what I am looking for. I have tried option 3, although the setup does run when another user logins no registry options appear in the HKCU.

I have decided to try option 2, but having searched the net etc I am unsure how you go through each user's hive on a system and change their HKCU. Could you if possible give me a hint or a bit of sample code to get me started.

Thanks for all your help.

Neeru
03-26-2007, 05:29 PM
Why are you using InstallScript to create your HKCU registry keys via an msi package (assuming this is an msi based installation)? In a Windows Installer based setup, Microsoft recommends you do the following:

1. Use the Registry table of the msi package to create your HKCU registry keys and make sure all of these keys are in one Component.
2. Set any one of these registry keys as the key path of this component.
3. Associate this component to a feature that contains a component with an Advertised Shortcut.

This is all that you need to do to ensure that windows installer package repairs for subsequent users and lays your HKCU keys on the machine.

AmberTiger
03-27-2007, 04:19 AM
Hi,

I am using an msi package but the software I am installing is basically an API connection for the rest of our software. Therefore on this install there are no shortcuts etc. Just installs the software and I set two registry keys in HKCU one is the location the user has selected for the install and the other is the API link into outlook on within the Addins part of software\microsoft\office\outlook\addins.

As the location can change, does the registry table except variables in the value column? And is what you suggest possible without an advertised shortcut?

Sorry if I have miss-understood you but it was done this way originally and I have taken over the installshield as the original person has left the company.

I have had no training either but that's another story!

Thanks.

LeslieEaster
03-27-2007, 10:23 AM
Use the easiest way to convert is to create a new component (Organization-->Setup Design, right click on the feature name and select New Component). Expand the component and select registry. In the middle pane, lower half, re-create the registry keys that are currently being done through your InstallScript code. Right-click on any of the value names and select Set Key Path. Finally, comment out the InstallScript code and test the results. This will repair the registry keys per-user.

Hope that helps,

AmberTiger
03-28-2007, 04:46 AM
Hi,

I have tried what you suggested and it creates all the correct registry keys under the account I am installing it under "Administrator". If I then log out and log in under a different user then there is no registry settings under their HKCU. I have put ALLUSERS=2 in the command line within the .ini file.

The only way I have managed to get it to work is to put the the command you suggested before in the HKLM key within activesetup.

I think I will go with this way, unless you have anymore ideas?

Thanks again for your help.

LeslieEaster
03-28-2007, 07:50 AM
Maybe I'm missing something or making the wrong assumptions. If you made the HKCU key a key path (by right-clicking on a value name and selecting Set Key Path) and the application is available as an advertised shortcut, then when a new user logs on and launches the application (via the shortcut), you should see a momentary Windows Installer dialog as it writes the HKCU key. I'm just curious, does this work?

AmberTiger
03-28-2007, 08:01 AM
Hi,

It does not display a settings window, the only time this occurs is when I do the HKLM registry setting. I assume an Advertised shortcut is a shortcut to your appliction - either on the start bar/desktop or quick launch bar - my installation has no such shortcuts. Does this affect the HKCU settings?

Neeru
04-10-2007, 12:12 PM
If you do not have an Advertised shortcut or file associations in your msi package, windows installer may not trigger a repair that is needed to updated your HKCU Registry data. Take a look at the following article : http://www.macrovision.com/company/news/newsletter/tips/repackaging_questions.shtml.
This artcile shows you how you can write into the HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup registry key to trigger an auto repair for your HKCU data to be populated when a new user logs in.