On Your Own: Lab 34 Reading the Registry Using WMI

In this lab, you will practice reading the registry by using the WMI StdRegProv class.

Lab Instructions

  1. Open Notepad.exe.

  2. Add Option Explicit to the first line of your script.

  3. Save the script as Lab34Solution.vbs.

  4. Declare the following variables: strKeyPath, strComputer, objReg, subKey, and arrSubKeys. The Header information section of your script will look like the following:

    Option Explicit
    Dim strKeyPath
    Dim strComputer
    Dim objReg
    Dim subKey
    Dim arrSubKeys
  5. Define a constant to be used for HKLM. Its hex value is &H80000002. Your code for this looks like the following:

    Const HKLM = &H80000002
  6. Assign the Software\Microsoft path to the strKeyPath variable. It will look like the following:

    strKeyPath = "SOFTWARE\Microsoft" ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.