views:

151

answers:

2

I have a Windows Server 2003 system that is used for terminal services. We do not use roaming profiles. We do not use login scripts. I have about thirty to fourty accounts that log into this system and as such have local profiles.

One of the software packages that are installed onto this system uses HKCU/Software reg tree for its licensing and so each user has the license key in their local profile.

How can I update all of these different profiles registries in a deterministic manner?

A: 

Mount the registry hive programatically, change the keys, then close the hive. Alternatively, you could use PSExec/runas to run the "update the keys" script as that user, which also solves the "edit HKCU" problem

Paul Betts
How do you mount all the hive's programatically? I haven't found out how to do that yet.
Try the "reg load" command
Paul Betts
+1  A: 

There are several ways to achieve what you want - one clunkier than the other. Terminal servers can be a deployment nightmare - users may not have rights to run msiexec.exe and hence MSI self-repair could fail. That's why I generally prefer to use batch files, scripts or reg files for the kind of situation you are facing.

I would use Microsoft's Active Setup feature. This is just a fancy name for a feature which allows you to "run something once per profile on login". Here is a reasonably good explanation: http://wikidesktop.org/index.php?title=Active%5FSetup

Here is a sample active-setup entry for an MSI file (this is the content of a *.reg file):

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]]
"StubPath"="[SystemFolder]msiexec.exe /q /fou [ProductCode]"

The "StubPath" command can be anything "runnable", and in your case I would suggest not running msiexec.exe but rather a vbscript via cscript.exe or some other batch mechanism (CMD, REG, Etc...). The reason is what I stated above: msiexec.exe may not be allowed to run for terminal server users. In other words, something like this:

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\MyProduct]
"StubPath"="[SystemFolder]cmd.exe /k C:\SomeScript.cmd"

There are other ways to add data to each user's profile such as using advertised MSI shortcuts and self-repair, but I wouldn't recommend that for terminal servers.

Glytzhkof
Here is perhaps a better explanation: http://www.etlengineering.com/installer/activesetup.txt
Glytzhkof