'==========================================================================
'
' VBScript:  AUTHOR: Ed Wilson , MS,  4/22/2006
'
' NAME: AlternateWMI.vbs
'
' COMMENT: <two ways to connect to wmi using moniker.>
'1.first way uses execquery and select statement on same line. 
'2.This returns an swbemObjectSet which is a collection.
'3.Get a specific instance, and it returns a sWbemObject which is not a 
'4.Collection. 
'==========================================================================

Set colitems = GetObject("winmgmts:\\").execquery _
	 ("Select * from win32_logicaldisk")
	WScript.Echo "colitems is: " & TypeName(colitems)
	
	For Each obj In colitems
		WScript.Echo "Drive name: " & obj.name
	Next

Set objitem = GetObject("winmgmts:\\").get _
	("win32_logicaldisk.deviceID='c:'")
	WScript.Echo "ObjItem is: " & TypeName(objitem)
	WScript.Echo "Size of drive " & objitem.size