Ad Widget

Collapse

Monitoring status /w wmi.get of USB devices

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • occ
    Junior Member
    • Jul 2015
    • 1

    #1

    Monitoring status /w wmi.get of USB devices

    Hi!

    Have been looking for several days now how to use the wmi.get function for an item, which would look for a printer's DeviceID and return the Status.

    What I've tried so far:

    Code:
    wmi.get[root\cimv2,SELECT Status FROM Win32_PnPEntity WHERE DeviceID LIKE %\\VID_04B8&PID_0202\\%]
    Code:
    wmi.get[root\cimv2,SELECT Status FROM Win32_PnPEntity WHERE DeviceID LIKE %VID_04B8&PID_0202\\%]
    Code:
    wmi.get[root\cimv2,SELECT Status FROM Win32_PnPEntity WHERE DeviceID=USB\\VID_04B8&PID_0202\\%]
    Code:
    wmi.get[root\cimv2,SELECT Status FROM Win32_PnPEntity WHERE DeviceID="USB\\VID_04B8&PID_0202\\%"]
    Code:
    wmi.get[root\cimv2,SELECT Status FROM Win32_PnPEntity.DeviceID=USB\\VID_04B8&PID_0202\\%]
    I've even tried to use the full path for the USB device on a single machine, including the S/N, to no avail. Here's the instance of interest as per WMI explorer output:

    Code:
    instance of Win32_PnPEntity
    {
    	Caption = "EPSON USB Controller for TM/BA/EU Printers";
    	ClassGuid = "{36fc9e60-c465-11cf-8056-444553540000}";
    	CompatibleID = {"USB\\Class_ff&SubClass_ff&Prot_02", "USB\\Class_ff&SubClass_ff", "USB\\Class_ff"};
    	ConfigManagerErrorCode = 0;
    	ConfigManagerUserConfig = FALSE;
    	CreationClassName = "Win32_PnPEntity";
    	Description = "EPSON USB Controller for TM/BA/EU Printers";
    	DeviceID = "USB\\VID_04B8&PID_0202\\544357460039060000";
    	HardwareID = {"USB\\VID_04B8&PID_0202&REV_0100", "USB\\VID_04B8&PID_0202"};
    	Manufacturer = "EPSON";
    	Name = "EPSON USB Controller for TM/BA/EU Printers";
    	PNPDeviceID = "USB\\VID_04B8&PID_0202\\544357460039060000";
    	Service = "TMUSB";
    	Status = "OK";
    	SystemCreationClassName = "Win32_ComputerSystem";
    	SystemName = "POSUS01001-08";
    };
  • Ankit_N
    Junior Member
    • Jun 2015
    • 2

    #2
    Monitoring status /w wmi.get of USB devices

    Hello OCC,

    The reason for all your wmi.get queries not working is that your Device ID contains (//_&&) which returns Invalid Exception in WMI.

    So ,try work around given below

    wmi.get[root\cimv2,select status from Win32_PnPEntity where PNPDeviceID like '%544357460039060000%']

    While creating a item select Type of information as Character .

    But if you remove the USB device, wmi. gets query won't get any data, thus it will return an error item not supported.

    Regards,
    Ankit_N

    Comment

    Working...