On Your Own: Lab 18a Using the Default WMI Moniker

In this lab, you will practice using the default WMI moniker. To do this, you write a cute little script that enumerates all the programs listed in the Add/Remove Programs dialog box, available from Control Panel.

Lab Instructions

  1. Open Notepad.exe.

  2. On the first line, type Option Explicit to ensure you declare all variables used in the script.

  3. Declare the following variables: objWMIService, colItems, and objItem. Add comments following each declaration to specify what each variable is used for.

  4. Set objWMIService equal to what comes back from the GetObject method when used in conjunction with the WMI moniker. Your code will look like the following:

    Set objWMIService = GetObject("winmgmts:\\")
  5. Set colItems ...

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.