The registry is the primary repository for system, application, and user profile configuration information for the Windows operating system. It is a hierarchical database that is structured and used much like a filesystem. The operating system uses the registry to store information as static as environment variables and as dynamic as performance data. The registry is constantly being used by the OS and applications to read, write, and query configuration settings.
Using a Graphical User InterfaceWindows 2000 came with two graphical registry editors that had different benefits. The first (regedit.exe) was more user-friendly, had better search capabilities, and was easy to work with while the other (regedt32.exe) was much more powerful. In Windows Server 2003, most of the features of these two tools were combined into a single tool. Now, Registry Editor has the same look and feel as the user-friendly version in Windows 2000 (regedit.exe), but also incorporates some important features such as permission editing from regedt32.exe. If you run either regedit.exe or regedt32.exe, you'll bring up the same tool. One other graphical tool you should be familiar with is Registry Monitor (regmon.exe) from Sysinternals. With it, you can view all of the registry activity on a system in real-time. You can restrict the output to a certain key, and limit the type of activity (read, write, etc.). I cover Registry Monitor in more detail in Recipe 9.12. Using a Command-Line InterfaceThe one command-line tool I use extensively throughout this chapter is reg.exe. In Windows 2000, reg.exe could be found in the Support Tools, but it comes installed by default with Windows Server 2003. With it, you can:
Using VBScriptWMI has a single class called StdRegProv that provides most of the functions you'll need to programmatically manage the registry. Table 9-1 lists the methods available with this class. This class is a little different from most others in that it doesn't contain properties for object instances (keys, values, etc.). To obtain information about a registry key or value, you have to use one of the methods shown in Table 9-1.
|