fork download
  1. Option Explicit
  2.  
  3. 'WMIにて使用する各種オブジェクトを定義・生成する。
  4. Dim oClassSet
  5. Dim oClass
  6. Dim oLocator
  7. Dim oService
  8. Dim sMesStr
  9.  
  10. 'ローカルコンピュータに接続する。
  11. Set oLocator = WScript.CreateObject("WbemScripting.SWbemLocator")
  12. Set oService = oLocator.ConnectServer
  13. 'クエリー条件をWQLにて指定する。
  14. Set oClassSet = oService.ExecQuery("Select * From Win32_PnPEntity")
  15.  
  16. 'コレクションを解析する。
  17. For Each oClass In oClassSet
  18. If InStr(oClass.Caption, "ISDB") > 0 Then
  19. sMesStr = sMesStr & "名前:" & oClass.Caption & vbCrLf & _
  20. "デバイス状態:" & oClass.ConfigManagerErrorCode & vbCrLf & _
  21. "デバイスID:" & oClass.PNPDeviceID & vbCrLf
  22. End If
  23. Next
  24.  
  25. MsgBox sMesStr
  26.  
  27. '使用した各種オブジェクトを後片付けする。
  28. Set oClassSet = Nothing
  29. Set oClass = Nothing
  30. Set oService = Nothing
  31. Set oLocator = Nothing
  32.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty