Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.7 KiB

  1. '
  2. ' test3.vbs
  3. '
  4. ' enumerate class and devices of class
  5. '
  6. DIM WshSHell
  7. DIM DevCon
  8. DIM SetupClasses
  9. DIM SetupClass
  10. DIM Devices
  11. DIM Device
  12. SET WshShell = WScript.CreateObject("WScript.Shell")
  13. SET DevCon = WScript.CreateObject("DevCon.DeviceConsole")
  14. WScript.Echo "Enumerate HDC"
  15. WScript.Echo ""
  16. '
  17. ' a class name may be used by more than one GUID
  18. ' so DevCon.GetSetupClasses may generate a list of more than one element
  19. '
  20. SET SetupClasses = DevCon.SetupClasses("hdc")
  21. Count = SetupClasses.Count
  22. Wscript.Echo "Count="+CStr(Count)
  23. FOR EACH SetupClass IN SetupClasses
  24. WScript.Echo "Class " + SetupClass + " = " + SetupClass.Guid
  25. SET Devices = SetupClass.Devices()
  26. FOR EACH Device IN Devices
  27. WScript.Echo " "+Device
  28. NEXT
  29. NEXT
  30. WScript.Echo ""
  31. WScript.Echo "Enumerate {4D36E96A-E325-11CE-BFC1-08002BE10318}"
  32. WScript.Echo ""
  33. '
  34. ' an empty list can be created
  35. '
  36. SET SetupClasses = DevCon.CreateEmptySetupClassList()
  37. '
  38. ' adding a GUID adds a single item. adding a name may add multiple items
  39. '
  40. SetupClasses.Add "{4D36E96A-E325-11CE-BFC1-08002BE10318}"
  41. SET Devices = SetupClasses(1).Devices()
  42. FOR EACH Device IN Devices
  43. WScript.Echo " "+Device
  44. NEXT
  45. WScript.Echo ""
  46. WScript.Echo "Enumerate HDC method 2"
  47. WScript.Echo ""
  48. '
  49. ' device list from classes collection
  50. '
  51. SET SetupClasses = DevCon.SetupClasses("hdc")
  52. SET Devices = SetupClasses.Devices()
  53. FOR EACH Device IN Devices
  54. WScript.Echo " "+Device
  55. NEXT
  56. WScript.Echo ""
  57. WScript.Echo "Enumerate HDC method 3"
  58. WScript.Echo ""
  59. '
  60. ' device list from class name directly
  61. '
  62. SET Devices = DevCon.DevicesBySetupClasses("hdc")
  63. FOR EACH Device IN Devices
  64. WScript.Echo " "+Device
  65. NEXT