We’ve all had that experience where we need to kick out a registry change to a machine for one reason or another that has to affect each and every user. And of course there’s not a HKEY_LOCAL_MACHINE (HKLM) registry key that’ll do the trick. So now you’ve got to make sure that every current user, every previous user, and every new user on the machine gets your registry change. It sounds like a tough job, and your boss breathing down your neck isn’t making it easier. Your task now is to save the day – and get it done in time to snatch the last doughnut in the break room before the guy in accounting finds it. So you roll up your sleeves and dig in…
First off, you may not be quite sure how to go about setting this up to be kicked off by SMS. Sure, you could do a domain group policy login script that’ll take care of it, or maybe use a .REG file to make the changes, but that’d take time to trickle down to your machines (and there’s that doughnut waiting for you). So why not get some more VBScripting experience under your belt?!
Here’s how you can deploy a complex, yet simple VBScript file to your SMS clients in order to make a change in all of the user registry hives on the machine. For those new to the registry, a hive is a group of keys, subkeys, and values that store information. When a user logs in their “NTUSER.DAT” file is loaded and becomes the set found within HKEY_CURRENT_USER. To test a setting change you can highlight HKEY_USERS and select File | Load Hive. Then navigate to and select the desired “NTUSER.DAT” file (you may need to make the hidden files and folders viewable). Just remember to highlight the loaded hive and select File | Unload Hive when finished.
As the comments within the accompanying VBScript file suggest, it will attempt to load each and every user registry hive on the machine, make the needed changes, and then close the hive (thus saving the changes). It will also make the adjustments to the default user profile so that new users will get the change, in addition to editing the registry settings for any currently logged in user. This script should work with either Windows XP, or Windows Vista machines.
Download: 12360User Registry Change VBScript.txt (change .TXT to .VBS)
SMS Notes: This script file may be “Run with administrative rights”, and may be executed “Whether or not a user is logegd on”. Depending on your production environment, it may be set to download (or not) to the SMS clients as desired.
* If you are dealing with binary registry settings, it may be easier to use a .REG file (see the VBScript file for a sample of how to execute one).
Now go enjoy your doughnut while SMS and VBScript do the heavy lifting…