0

如何以编程方式和一次性交易运行以下 WMI 查询?我可以使用 Visual Studio 2008,如果可以,我应该设置什么语言和项目类型?我是一个完整的初学者,所以请提供详细信息。谢谢!

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

这是来自 CodeGuru 的查询的来源

4

1 回答 1

1

WMI 代码创建者将以几种语言为您创建代码片段。它非常适合这种任务。

于 2008-12-31T23:11:48.193 回答