Connecting to the Registry

To work with the registry, you need to connect to it first. You can use the WMI StdRegProv class to make a connection and to read or write information into it. Although reading from the registry is a safe process, writing to the registry could have disastrous consequences if you don’t take normal safety precautions such as making a backup of the key you intend to change and testing the script in a lab on machines that would be easily recoverable.

At times, just being able to read a listing of keys is sufficient for your needs. For instance, when the hotfix installer is run, it creates an entry under HKLM\SOFTWARE \Microsoft\Windows NT\CurrentVersion\HotFix. Realizing this, if you read this key, you can see what hotfixes ...

Get Microsoft® Windows® Scripting Self-Paced Learning Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.