'==========================================================================
'
' NAME: <listWmiClassesDictionary.vbs>
'
' AUTHOR: Ed Wilson , MS
' DATE  : 4/17/2006
' COMMENT: <Uses the ListWMIClasses.vbs script as starter to list wmi classes>
'1.Displays the class name associated with an SWbemPath object
'2.Creates a dictionary object, and uses it to search class names for a String
'3.This gives you the chance to find classes that may be related to one
'4.another. Search for drive to see drive related classes, search for volume
'5.process,processor,file,whatever and it will help you find classes you need.
'==========================================================================
Option Explicit
Dim strcomputer 	'target computer
Dim wmiNS					'wmi namespace
Dim objwmiService	'SwbemServices object. The connection into WMI
Dim colClasses 		'sWbemObject set object. A collection of items
Dim objClass			'sWbemObject. An item in colClasses
Dim objDictionary	'holds the dictionary object
Dim strKey				'holds dictionary key
Dim strSearch			'String to search For

strSearch = "process" 
strComputer = "."
wmiNS = "\root\cimv2" 'must precede namespace with \

Set objDictionary = CreateObject("Scripting.Dictionary")
Set objwmiService = _
    GetObject("winmgmts:\\" & strComputer & wmiNS)
Set colClasses = objwmiService.SubclassesOf()

For Each objClass In colClasses
    objDictionary.Add objClass.Path_.class, objClass.Path_.class
Next


For Each strKey In objDictionary.Keys
	If InStr(1,strKey, strSearch,vbTextCompare) Then
		WScript.Echo strKey
	End If
next
