Understanding WMI Scripting

4.4: Exploring the WMI scripting API

4.4 Exploring the WMI scripting API

In the previous paragraph, based on the moniker type provided, we saw that it is possible to obtain two different WMI objects:

  1. SWbemObject with the moniker

    winmgmts://NET-DPEN6400A/Root/CIMv2:Win32_Service.name="SNMP"'

    or

    winmgmts://NET-DPEN6400A/Root/CIMv2:Win32_Service
  2. SWbemServices with the moniker

    winmgmts://NET-DPEN6400A/Root/CIMv2

These two objects are part of the WMI scripting API. The WMI scripting API is a collection of COM objects enabling a script writer to read or write information and perform various operations with WMI and the real world manageable entities that the CIM repository represents. The WMI scripting object model exposes two different natures of objects that can be categorized as follows:

  1. Single objects

  2. Collections of objects

The nature of the object desired determines the way the object is instantiated. There are two different ways to instantiate objects with WMI:

  1. Using a language statement to create an object with the COM ProgID. Based on the script language used, the script code will use a CreateObject for VBScript, a new ActiveXObject for JScript, or an XML tag in an ASP page or a Windows Script File.

  2. Using the WMI moniker with the GetObject statement for VBScript or JScript.

The different object natures with their associated instantiation methods are summarized in Figure 4.2 as represented by the Microsoft SDK.


Figure 4.2: Symbols used to represent the WMI object model.

Symbols are used to differentiate the objects. In the following sections, we examine the WMI scripting API object model tree and explain the relationship between the...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Middleware
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.