Discover USB Devices of typ HID via WMI (unique identifier)

Alexander Ljung
Kilo Expert

Hello lovely people,

I'd need some help brainstorming from the community.

I have computers which have USB devices connected. Most of the devices are uniquely recognized (such as printers) in a WMI namespace which makes sense. Same for keyboards, mouses etc. Getting this into ServiceNow is there for not a big problem.

But for the devices which are only recognized as HID generic devices - how should I approach it? They don't have a unique ID or name from what I can see which I always can use for "translation" into creating a CI.

I thought that if I can find that drivers are installed on the computers, I could determine that if Driver X is installed then I know for sure that a specific device must be connected. But the challenge is that the drivers exist in every single computer so I will aways find them installed. Even if the USB device is not connected.

Any creative solutions out there to this? USB serial maybe? What can I use as the unique identifier for HID devices!?

Thanks in advance,

Alex

 

1 ACCEPTED SOLUTION

Fernando90
Giga Contributor

Hi Alex,

You can likely use the hardware IDs. 

In the Windows device manager you can find these by opening the device properties > details tab > Property 'Hardware IDs'  to find the unique? hardware IDs.

When checking with WMI you can also retrieve the devices directly from CIM_LogicalDevice:
WQL: select * from CIM_LogicalDevice

When checking the MOF for one of my devices it outputs as following: 

{
	Caption = "USB Input Device";
	ConfigManagerErrorCode = 0;
	ConfigManagerUserConfig = FALSE;
	CreationClassName = "Win32_PointingDevice";
	Description = "USB Input Device";
	DeviceID = "USB\\VID_046D&PID_C077\\7&34753A11&0&4";
	DeviceInterface = 162;
	HardwareType = "USB Input Device";
	InfFileName = "input.inf";
	InfSection = "HID_Inst.NT";
	Manufacturer = "(Standard system devices)";
	Name = "USB Input Device";
	NumberOfButtons = 0;
	PNPDeviceID = "USB\\VID_046D&PID_C077\\7&34753A11&0&4";
	PointingType = 2;
	PowerManagementSupported = FALSE;
	Status = "OK";
	SystemCreationClassName = "Win32_ComputerSystem";
	SystemName = ############
};

 

In my case this is a generic USB mouse, so it also uses a generic driver for a HID-compliant Opitcal Wheel mouse.
However if you have specific USB hardware you are identifying - the hardware IDs probably correspond to a specific driver that is needed allowing you to identify the device as well.

Perhaps there is some kind of online database you can run the ID and related data to identify the driver/device.

Once you have identified the available hardware ID's at the customer you can probably add these to the customer environment as well for easier identification/matching. (but will require some maintenance keeping it up to date)

Let me know if this was helpful.
It would be interesting to hear if other people have ran into this as well - or may have taken a different approach to it. 

View solution in original post

3 REPLIES 3

Fernando90
Giga Contributor

Hi Alex,

You can likely use the hardware IDs. 

In the Windows device manager you can find these by opening the device properties > details tab > Property 'Hardware IDs'  to find the unique? hardware IDs.

When checking with WMI you can also retrieve the devices directly from CIM_LogicalDevice:
WQL: select * from CIM_LogicalDevice

When checking the MOF for one of my devices it outputs as following: 

{
	Caption = "USB Input Device";
	ConfigManagerErrorCode = 0;
	ConfigManagerUserConfig = FALSE;
	CreationClassName = "Win32_PointingDevice";
	Description = "USB Input Device";
	DeviceID = "USB\\VID_046D&PID_C077\\7&34753A11&0&4";
	DeviceInterface = 162;
	HardwareType = "USB Input Device";
	InfFileName = "input.inf";
	InfSection = "HID_Inst.NT";
	Manufacturer = "(Standard system devices)";
	Name = "USB Input Device";
	NumberOfButtons = 0;
	PNPDeviceID = "USB\\VID_046D&PID_C077\\7&34753A11&0&4";
	PointingType = 2;
	PowerManagementSupported = FALSE;
	Status = "OK";
	SystemCreationClassName = "Win32_ComputerSystem";
	SystemName = ############
};

 

In my case this is a generic USB mouse, so it also uses a generic driver for a HID-compliant Opitcal Wheel mouse.
However if you have specific USB hardware you are identifying - the hardware IDs probably correspond to a specific driver that is needed allowing you to identify the device as well.

Perhaps there is some kind of online database you can run the ID and related data to identify the driver/device.

Once you have identified the available hardware ID's at the customer you can probably add these to the customer environment as well for easier identification/matching. (but will require some maintenance keeping it up to date)

Let me know if this was helpful.
It would be interesting to hear if other people have ran into this as well - or may have taken a different approach to it. 

shembop
Tera Contributor

Care you share how you got them into ServiceNow? I am digging through the community and docs and not finding anything I can "borrow" to modify to do what I want.

GB14
Kilo Patron

Hello @shembop  

were you able to figure this out? We are looking to discover the local devices as well.