Wmi

rmatthew

Centurion
Joined
Dec 30, 2002
Messages
115
Location
Texas
I have the following Code:

Dim query As New SelectQuery("Win32_DiskDrive")
Dim searcher As New ManagementObjectSearcher(query)
Dim disk As ManagementObject

For Each disk In searcher.Get
Debug.WriteLine(disk("MediaLoaded") & vbTab & disk("InterfaceType"))
Next

Problem is it does not iterate through all disk drives????

Any ideas.
 
Guess I should indicate in better detail what it is I am trying to do....

I need to know when an instance of a logical drive is created.

All methods I have attempted spin the disk(s) at intervals... WMI, getdrives etc.

Any ideas?
 
Select Statement?

I've only messed with WMI using vbscript, but don't you need a Select statement in there somewhere?

Visual Basic:
'Query WMI to get system information (mfg, model)	  
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & _
   oNet.computername & "\root\cimv2")

Set colSettings = objWMIService.ExecQuery _
   ("Select * from Win32_ComputerSystem")

For Each objComputer In colSettings
   strComputer = trim(objComputer.Manufacturer) "|" & _
      trim(objComputer.Model)
Next
 
Back
Top