Working with Software: Step-by-Step Exercises

In this exercise, we explore the use of WIN32_product and classes provided by the Windows installer provider.

  1. Open Notepad or your favorite script editor.

  2. At the top of your script, declare a variable called $strComputer. Assign the WMI shortcut dot character (.) to indicate you want to connect to WMI on your local machine. This line of code is shown here:

    $strComputer = "."
  3. On the next line, declare the variable $wmiNS, which will be used to hold the WMI namespace for your query. Assign the string "Root\cimv2" to the variable. This line of code is shown here:

    $wmiNS = "root\cimv2"
  4. On the next line, you will use the variable $wmiQuery to hold your WMI query. This query will select everything from the WIN32_ ...

Get Microsoft® Windows PowerShell™ Step By Step 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.