• subscribe
December 01, 1997 12:00 AM

New Ways to Mine the Registry

Windows IT Pro
InstantDoc ID #287

Editing the Registry on Multiple Computers
To make Registry changes to several computers across the network, you can use the System Policy Editor (SPE) to create policies that download to each computer as it logs on to the network. (For information on SPE, see Related Articles in Windows NT Magazine.) You can also use Regedit's import feature as a low-tech alternative to the SPE. For example, if you want to change a specific Registry setting on multiple computers, you can create a Registry data file with the new setting and import it on each computer you want to modify. In Clayton Johnson's, "Installing Applications Across the Network," April 1997, the author suggests that you use a share that anybody on the network can connect to and install optional software from. This approach requires that you visit each workstation and add a new value (AppInstallPath) to the Registry before the user can take advantage of the share. You can create a .reg file with the new value and place it on the share. The first time a workstation connects to the share, the user imports the Registry file, which enables the network installation feature on the user's computer.

For the example in Clayton Johnson's article, you need to add the AppInstallPath value to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion key. Following the instructions in the article, edit the Registry, add the value, and give it the path of the Apps.inf file. Then use Regedit to export the Registry key to a file. The file will look similar to the following:

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]

"DevicePath"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,69,6e,66,00

"MediaPathUnexpanded"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,4d,65,64,

69,61,00

"ProgramFilesDir"="D:\\Program Files"

"CommonFilesDir"="D:\\Program Files\\Common Files"

"MediaPath"="D:\\WINNT\\Media"

"AppInstallPath"="\\\\server1\\winnt\\inf\\apps.inf"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths]

...

Using a text editor, remove everything from the file except REGEDIT4, the first key, and the AppInstallPath items. This step will leave you with just the following:

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]

"AppInstallPath"="\\\\server1\\winnt\\inf\\apps.inf"

The file now contains only the new entry, so NT won't overwrite any existing entries when you import the file. The [HKEY...] line simply identifies the right location for the new entry.

Name this file something intuitive, such as Appinst.reg, and place it on the share you are using for software distribution. Create a batch file that runs Regedit on the .reg file. For example, Appinst.bat could contain regedit/s appinst.reg. Now when users want to enable their workstation for the network software installation, all they have to do is go to the network share and run Appinst. This approach is a vast improvement over visiting each workstation and editing the Registry by hand.

Registry Editing Over the Web
You can also use a Web browser to edit the Registry, but this practice can be risky. If someone maliciously or accidentally causes your Web browser to import a Registry file, that user can corrupt or compromise your system. Listing 1, page 178, shows HTML that uses links to the Registry scripts I created earlier.

After I created the HTML, I selected the Programs tab from Options under the View menu in Internet Explorer (IE) to designate Regedit as a viewer for .reg files. I set the action to be Open with the application command line set to C:\Winnt\Regedit.exe /s "%1". When you view the HTML file and double-click the link, the Web server downloads the .reg file to the Web browser, which runs Regedit on the file (%1). Screen 1 shows the HTLM page in IE. Obviously, this example is not the most sophisticated HTML front end to the Registry, but it demonstrates some powerful features.

Never leave your Web browser configured this way when you're browsing the Internet, but this method has possibilities for intranet use. For example, you can create a Web page that lets your remote NT users make Registry edits on their machines simply by going to your Web site, reading the instructions, and clicking a few buttons.

If you are administering NT computers in a complex production environment, you'll want to develop some tools for making Registry changes in a safe and efficient manner. You have several choices mining the NT Registry.



ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here