SHARE
TWEET

Get_HardwareID.vbs

hackoo May 15th, 2020 (edited) 1,187 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Run this vbscript with cscript engine
  2. Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
  3. Set colsHardwareID = objWmiService.ExecQuery("Select * from Win32_PnPEntity")
  4.  
  5. For Each objItem In colshardwareID
  6.    If Not IsNull(objItem.HardwareID) Then
  7.       For Each StrHardwareID In objItem.HardwareID
  8.         ReDim Preserve ArrHardwareID(i)
  9.         ArrHardwareID(i) = strHardwareID
  10.         i = i + 1
  11.       Next
  12.    End If
  13. Next
  14.  
  15. For Each HID In ArrHardwareID
  16.     WScript.Echo HID
  17. Next
  18.  
  19. ' List Plug and Play Devices
  20. strComputer = "."
  21. Set objWMIService = GetObject("winmgmts:" _
  22.     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  23.  
  24. Set colItems = objWMIService.ExecQuery("Select * from Win32_PnPEntity")
  25.  
  26. For Each objItem in colItems
  27.     Wscript.Echo "Class GUID: " & objItem.ClassGuid
  28.     Wscript.Echo "Description: " & objItem.Description
  29.     Wscript.Echo "Device ID: " & objItem.DeviceID
  30.     Wscript.Echo "Manufacturer: " & objItem.Manufacturer
  31.     Wscript.Echo "Name: " & objItem.Name
  32.     Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID
  33.     Wscript.Echo "Service: " & objItem.Service
  34. Next
  35.  
  36.  
  37. ' List Pointing Device Properties
  38.  
  39.  
  40. On Error Resume Next
  41.  
  42. strComputer = "."
  43. Set objWMIService = GetObject("winmgmts:" _
  44.     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  45.  
  46. Set colItems = objWMIService.ExecQuery("Select * from Win32_PointingDevice")
  47.  
  48. For Each objItem in colItems
  49.     Wscript.Echo "Description: " & objItem.Description
  50.     Wscript.Echo "Device ID: " & objItem.DeviceID
  51.     Wscript.Echo "Device Interface: " & objItem.DeviceInterface
  52.     Wscript.Echo "Double Speed Threshold: " & objItem.DoubleSpeedThreshold
  53.     Wscript.Echo "Handedness: " & objItem.Handedness
  54.     Wscript.Echo "Hardware Type: " & objItem.HardwareType
  55.     Wscript.Echo "INF File Name: " & objItem.InfFileName
  56.     Wscript.Echo "INF Section: " & objItem.InfSection
  57.     Wscript.Echo "Manufacturer: " & objItem.Manufacturer
  58.     Wscript.Echo "Name: " & objItem.Name
  59.     Wscript.Echo "Number Of Buttons: " & objItem.NumberOfButtons
  60.     Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID
  61.     Wscript.Echo "Pointing Type: " & objItem.PointingType
  62.     Wscript.Echo "Quad Speed Threshold: " & objItem.QuadSpeedThreshold
  63.     Wscript.Echo "Resolution: " & objItem.Resolution
  64.     Wscript.Echo "Sample Rate: " & objItem.SampleRate
  65.     Wscript.Echo "Synch: " & objItem.Synch
  66. Next
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top