1

I was trying to get usb-printer name using wmi query via c# application. I use this example. Result was

Device ID: USB\VID_0B0B&PID_106E\5&18F54CB7&0&2, PNP Device ID: USB\VID_0B0B&PID_106E\5&18F54CB7&0&2, Description: USB Printing Support

That's not suiteble for me, in windows device manager it shows as DatamaST-3210. After that, I try to get data using WmiExplorer

select * from Win32_PnPEntity

And I get 2 devices:

instance of Win32_PnPEntity
{
    Caption = "USB Printing Support";
    ClassGuid = "{36fc9e60-c465-11cf-8056-444553540000}";
    CompatibleID = {"USB\\Class_07&SubClass_01&Prot_02", "USB\\Class_07&SubClass_01", "USB\\Class_07"};
    ConfigManagerErrorCode = 0;
    ConfigManagerUserConfig = FALSE;
    CreationClassName = "Win32_PnPEntity";
    Description = "USB Printing Support";
    DeviceID = "USB\\VID_0B0B&PID_106E\\5&18F54CB7&0&2";
    HardwareID = {"USB\\VID_0B0B&PID_106E&REV_0304", "USB\\VID_0B0B&PID_106E"};
    Manufacturer = "Microsoft";
    Name = "USB Printing Support";
    PNPDeviceID = "USB\\VID_0B0B&PID_106E\\5&18F54CB7&0&2";
    Service = "usbprint";
    SystemCreationClassName = "Win32_ComputerSystem";

};

instance of Win32_PnPEntity
{
    Caption = "DatamaxST-3210";
    ConfigManagerErrorCode = 0;
    ConfigManagerUserConfig = FALSE;
    CreationClassName = "Win32_PnPEntity";
    Description = "DatamaxST-3210";
    DeviceID = "USBPRINT\\DATAMAXST-3210\\6&93D5382&B&USB001";
    HardwareID = {"USBPRINT\\DatamaxST-3210A4C7", "DatamaxST-3210A4C7"};
    Name = "DatamaxST-3210";
    PNPDeviceID = "USBPRINT\\DATAMAXST-3210\\6&93D5382&B&USB001";
    Status = "OK";
    SystemCreationClassName = "Win32_ComputerSystem";
};

First one have DeviceID with data I use for searching, but not Caption. Second device have correct Caption and no info about his vid\pid.

Using windows device manages I see that my device have Parent with correct vid/pid. I belive that USBPRINT device is a child of USB\VID_...

So, how can I get USBPRINT device name by knowing devices VID\PID?

Heavyrro
  • 11
  • 4
  • It is not obvious how that could be helpful. You wouldn't want to tie your code to a specific printer model and if you have two printers from the same manufacturer then they have the same pid/vid. https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem – Hans Passant May 16 '18 at 14:10
  • 1
    @HansPassant They will have different DeviceID even with same vid\pid, are not? I defenetly prefer to see normal names in list rather than "USB Printing Support" – Heavyrro May 16 '18 at 15:13
  • Hi Heavyrro, were you able to find a code solution for your question? – Moises Gonzaga Nov 17 '21 at 22:59
  • @MoisesGonzaga no, I didn't find solution. I end up with hardcoded vid/pip into my code and connecting to device with it, instead of implementing some king of search window. – Heavyrro Aug 10 '23 at 20:08
  • Hi, was you able to get the driver name using c#? – Rizwan Ranjha Aug 29 '23 at 04:06
  • @RizwanRanjha sadly no, soon after that this project was abandoned and i never really returns to it – Heavyrro Aug 31 '23 at 07:37

0 Answers0