Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
483 views
in Technique[技术] by (71.8m points)

scripting - Updating every profile's registry on Windows Server 2003

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Active Setup is no longer advisable (original source).


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 good explanation: http://www.etlengineering.com/installer/activesetup.txt

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

REGEDIT4

[HKEY_LOCAL_MACHINESOFTWAREMicrosoftActive SetupInstalled 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_MACHINESOFTWAREMicrosoftActive SetupInstalled ComponentsMyProduct]
"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. See this serverfault.com answer for information on problems with the use of MSI files for registry settings.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...