How do I run the following WMI query?

How do I run the following WMI query, both programmatically and as a one-time trade? Can I use Visual Studio 2008, and if so, what language and project type am I setting up? I am a complete newbie, so please provide details. Thank!

SELECT * FROM Win32_USBControllerDevice
For Each as USBDevice
   ASSOCIATORS OF {Win32_PnPEntity.DeviceID="<USBDevice.Dependent>"}
    WHERE ResultClass = Win32_DiskDrive
   For Each as Drive
      ASSOCIATORS OF {Win32_DiskDrive.DeviceID="<Drive.DeviceID>"} 
       WHERE AssocClass = Win32_DiskDriveToDiskPartition
      For Each as Drive2Part
         ASSOCIATORS OF {Win32_DiskPartition.DeviceID="<Drive2Part.DeviceID>"} 
          WHERE AssocClass = Win32_LogicalDiskToPartition
         For Each as Disk2Part
            Win32_LogicalDisk = <Disk2Part.Dependent>
         End For
      End For      
   End For
End For

      

Here's the source of the request from CodeGuru.

0


source to share


1 answer


The WMI code creator will generate snippets for you in multiple languages. It is very handy for this kind of task.



+1


source







All Articles