Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


April 2001

Distributing Registry Changes


RSS
Subscribe to Windows IT Pro | See More Registry Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!
SideBar    A Registration File Drawback, Registry Data Types, Make the Connection

Regini Features
Regini gives you several options for data manipulation. For example, DELETE is a regini.exe keyword that requires only the name of the data item. To remove a data item, enter the following syntax as the second (i.e., data item) line of your script:

DataItemName = DELETE

Regini.exe also has a neat feature that lets you point to a text file that contains the value for a data item. This feature eliminates the need to directly enter long binary values (for REG_BINARY data items) or many multiple strings (for REG_ MULTI_SZ data items). During execution, regini.exe opens the target file and writes its contents to the registry as the value for the data item. To use this feature, replace the item type with an instruction to use a file. The instruction includes a reference to the item type and uses the following syntax options:

  • For REG_BINARY data items: DataItemName = REG_BINARYFILE FilePath
  • For REG_MULTI_SZ data items: DataItemName = REG_MULTISZFILE FilePath

For example, if you enter the following script:

UserNicknamesForCompanyNewsletter = REG_MULTISZFILE \myscripts\script101.txt

Regini reads the content of the file named script101.txt and writes the contents as the value of the data item UserNicknamesForCompanyNewsletter. (I made up that data item for this example, so don't look for it in your registry.)

Putting It All Together
As an example of a complete command, review the following script. This command changes computer settings so that the most recent user's name doesn't appear in the Logon dialog box.

\registry\machine\software\micro
soft\windows\currentversionpolicies\system
DontDisplayLastUserName = REG_DWORD 1

To make additional changes in the same subkey, you need only add lines below the line that references the subkey. As long as each additional line contains an equal sign, regini.exe properly handles the line's content. For example, the data items that control pre-logon messages (i.e., LegalNoticeText and LegalNoticeCaption) reside in the same registry subkey as the DontDisplayLastUserName item. To also configure the computer to display a message before users log on, simply add two lines to the previous script:

\registry\machine\software\micro
soft\windows\currentversionpolicies\system
DontDisplayLastUserName = REG_DWORD 1
LegalNoticeText = REG_SZ Your E-Mail is Now Being Monitored
LegalNoticeCaption = REG_SZ Notice To Employees

Option 3: Use Policies
You can also distribute registry changes by creating system policies that manipulate the registries of target users. The process you use varies between Win2K (which uses the Microsoft Management Console—MMC—GPE snap-in) and earlier versions of Windows (which use SPE), but in either case, you can build administration (.adm) files to send registry changes to selected computers.

The easiest way to create an .adm file is to use an existing .adm template as a starting point. Templates are text files, and you can open them in Notepad or any text editor. Before you do anything with existing templates, back up the originals. When you modify a template, save the new version with a new filename, even if you've backed up the original. And you must test your new .adm files in a lab environment before you unleash your creation on the enterprise. (See Reader to Reader, ".adm Files and the Headaches They Can Cause," October 1999, for a description of the consequences you might face if you ignore this advice.)

Of course, to implement a registry change through an .adm template, you need to know which registry key to target. The resource kits' registry documentation is rather sparse. To learn my way around the registry, I used a lab environment to plunge in and make system changes with existing policies and Control Panel applets. I used Sysinternals' regmon.exe (available from http://www.sysinternals.com) to track the resulting registry changes. Eventually, I learned quite a bit about the registry's organization and registry entries' data types.

   Previous  1  2  3  [4]  5  6  Next 


Reader Comments
<br>In "Distributing Registry Changes" (April 2001), Kathy Ivens states, "Registration (.reg) files can't delete anything in the registry." They can! I use .reg files to customize my desktop at startup, and one of the registry subkeys I delete is HKEY_CURRENT_
USER\Software\Microsoft\WindowsCurrentVersion\Explorer\MenuOrder. Deleting this key makes the contents of my Favorites and Start Menu folders appear in alphabetical order. In the .reg file, I simply insert a hyphen (-) inside the brackets that enclose the registry path to the subkey that I want to delete. However, I'm not sure how to use .reg files to delete individual registry values. I usually just delete the entire key and reimport the values I want.<br>

Patrick S. Seymour June 19, 2001


<br><i>You're correct, and several readers pointed out the error. In fact, deleting keys and items with a .reg file is dangerously easy. Putting a hyphen at the beginning of the registry path deletes the key. To delete an individual data item in a registry key, use this format in the .reg file.<br><br>
&lt;RegistryEditorVersion&gt;<br><br>

[&lt;RegistryPath&gt;] <br>
"&lt;DataItemName&gt;"=- <br><br>

The best way to proceed is to use regedit to export the key, then edit the .reg file and insert the appropriate hyphens. Use Save As, and apply a new filename to this revised .reg file. That way, you can make sure the original values are still available in case you do something wrong or change your mind. Just double-click your new .reg file to merge its contents into the registry.</i><br>
<i>--Kathy Ivens</i>

Kathy Ivens June 19, 2001


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

New Microsoft/Yahoo! Deal? No

On Sunday, the Times of London reported that Microsoft had renewed talks with failing Internet giant Yahoo! and would manage its search engine for 10 years, while Yahoo! would retain control of its email, messaging, and content services. This report ...

How can I stop and start services from the command line?

...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing