2008-12-31 75 views
0

如何以編程方式運行以下WMI查詢並作爲一次性交易?我可以使用Visual Studio 2008嗎?如果是的話,我可以設置什麼語言和類型的項目?我是一個完整的初學者,所以請提供詳細信息。謝謝!如何運行以下WMI查詢?

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查詢的source

回答

1

WMI Code creator將爲您在幾種語言中創建片段。它非常適合這種任務。

+0

我已經試過了WMI Code Creator,以及Scriptomatic和WMI Tools,但是他們都沒有辦法讓我運行上面的查詢。 – 2009-01-01 01:34:39