Understanding WMI Scripting

4.5: Browsing the namespaces in the CIM repository

4.5 Browsing the namespaces in the CIM repository

Throughout this chapter, we have worked in the Root\CIMv2 namespace. Although it is an important namespace because it contains most of the WMI Win32 class representing Windows manageable entities, there are other namespaces that contain quite useful information. As previously mentioned, instead of listing all namespaces and classes in tables, it is much more interesting to have a script to retrieve such information. This protects against any new non-documented WMI extensions, because a script can retrieve this information from the CIM repository for you. Note, as already mentioned, using a WQL query to retrieve all namespaces available is not possible because WQL does not support cross-namespace queries.

Since the classes are contained in namespaces, let's retrieve the namespaces first. In Chapter 2, we listed in Table 2.1 the namespaces available in the CIM repository. Sample 4.28 shows how to retrieve the namespaces available in the CIM repository.

Sample 4.28: Browsing all namespaces defined in the CIM repository
   1:   .:   8:   9:    ..:  13:      14:  15:      51:    52:

This script is a quite easy script as it uses just a few of the WMI scripting API objects mentioned in this chapter. Basically, the script starts to browse from the root namespace (line 21) by invoking a recursive function called DisplayNameSpaces() (line 24). This function performs a connection to the CIM repository...

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: Digital Asset Management Software
Finish!
Privacy Policy

This is embarrasing...

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