|
-
Jan 10th, 2006, 02:43 PM
#1
Thread Starter
Junior Member
How are devices identified uniquely?
Friends
I am working on a project which requires detection of USB devices.
For this i am using WMI and using the class Win32_USBHub.
This class returns many properties like Device_ID, DESCRIPTION, Name etc.
but i would like to know how windows actually identifies a device.
For eg :- pen drive, keyboards, mouse, digital cameras etc.
Description for Pen Drive and Digital Camera gives "Mass storage device" .
So i cannot use Description property
Problem with Device_ID is every pen drive has got different Device_ID.
I want something that will uniquley address a pen drive device irrespective of their device_id.
Please help...
(Note:- solution in WMI is preferable)
THANK YOU
-
Jan 10th, 2006, 03:18 PM
#2
Re: How are devices identified uniquely?
Here is the WMI code to detect the USB controllers/devices on your system. It was generated by Scriptomatic v2 from MS that you can download for free.
Note the results from my system is trimmed down to remove the controllers and I only left the device - my Sony digital camera. It specifies "REMOVABLEMEDIA" as a type. I didnt get my pen drive out for the test but I would think it would show as different. Maybe I'll try it now.
VB Code:
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("VBGURU")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_USBControllerDevice", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "AccessState: " & objItem.AccessState
WScript.Echo "Antecedent: " & objItem.Antecedent
WScript.Echo "Dependent: " & objItem.Dependent
WScript.Echo "NegotiatedDataWidth: " & objItem.NegotiatedDataWidth
WScript.Echo "NegotiatedSpeed: " & objItem.NegotiatedSpeed
WScript.Echo "NumberOfHardResets: " & objItem.NumberOfHardResets
WScript.Echo "NumberOfSoftResets: " & objItem.NumberOfSoftResets
WScript.Echo
Next
Next
VB Code:
AccessState:
Antecedent: \\VBGURU\root\cimv2:Win32_USBController.DeviceID="PCI\\VEN_8086&DEV_24D2&SUBSYS_80A61043&REV_02\\3&267A616A&0&E8"
Dependent: \\VBGURU\root\cimv2:Win32_PnPEntity.DeviceID="USBSTOR\\DISK&VEN_SONY&PROD_SONY_DSC&REV_4.50\\6&35C56897&0"
NegotiatedDataWidth:
NegotiatedSpeed:
NumberOfHardResets:
NumberOfSoftResets:
AccessState:
Antecedent: \\VBGURU\root\cimv2:Win32_USBController.DeviceID="PCI\\VEN_8086&DEV_24D2&SUBSYS_80A61043&REV_02\\3&267A616A&0&E8"
Dependent: \\VBGURU\root\cimv2:Win32_PnPEntity.DeviceID="STORAGE\\REMOVABLEMEDIA\\7&5D1629E&0&RM"
NegotiatedDataWidth:
NegotiatedSpeed:
NumberOfHardResets:
NumberOfSoftResets:
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 10th, 2006, 03:21 PM
#3
Re: How are devices identified uniquely?
Ok here it is for my jump drive or pen drive. There is an identifier between the 2.
VB Code:
AccessState:
Antecedent: \\VBGURU28\root\cimv2:Win32_USBController.DeviceID="PCI\\VEN_8086&DEV_24DD&SUBSYS_80A61043&REV_02\\3&267A616A&0&EF"
Dependent: \\VBGURU28\root\cimv2:Win32_PnPEntity.DeviceID="USBSTOR\\DISK&VEN_&PROD_USB_DISK_PRO&REV_1.13\\483619010A5B&0"
NegotiatedDataWidth:
NegotiatedSpeed:
NumberOfHardResets:
NumberOfSoftResets:
AccessState:
Antecedent: \\VBGURU\root\cimv2:Win32_USBController.DeviceID="PCI\\VEN_8086&DEV_24DD&SUBSYS_80A61043&REV_02\\3&267A616A&0&EF"
Dependent: \\VBGURU\root\cimv2:Win32_PnPEntity.DeviceID="STORAGE\\REMOVABLEMEDIA\\7&D5604D5&0&RM"
NegotiatedDataWidth:
NegotiatedSpeed:
NumberOfHardResets:
NumberOfSoftResets:
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 11th, 2006, 02:07 PM
#4
Thread Starter
Junior Member
Re: How are devices identified uniquely?
I am sorry, but i donot understand what is happening???
I would be gr8ful if u could explain me what is going on???
Why do u need an array in the first place?
By the way which property is giving u removable media???
Thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|