First, I have to say im terrible at com objects. I got this code somewhere (I forgot where) and somehow managed to modify it to fit my needs. The script currently reads from the list of hardware id that is currently connected to the system and checks for a certain id in that list. This is pretty resource intensive on my system. Adding sleep to it makes it more manageable, however it takes a lot longer to detect newly connected hardware. How do I get it to only check for a specific id? The ID I'm
The WMIExplorer tool helped me figure out the issue. The problem was I was searching for
SELECT * FROM Win32_PnPEntity WHERE Name LIKE '%%'
a Win32_PnPEntity where it's name could be anything. Thus, when I tried to specify a name,
SELECT * FROM Win32_PnPEntity WHERE Name LIKE '%USB\\VID_045E&PID_02E4&IGA_00%'
it returned nothing because I wasn't inputting a name, I was inputting a DeviceID. Changing it to
SELECT * FROM Win32_PnPEntity WHERE DeviceID Like '%USB\