none
How to get printer Class GUID in C# RRS feed

Answers

  • I am not sure what property you have looked at.

    C:\>wmic path Win32_PnPEntity where "PNPClass='cdrom'" get ClassGuid
    ClassGuid
    {4d36e965-e325-11ce-bfc1-08002be10318}



    Visual C++ MVP

    • Marked as answer by LouisC27 Monday, April 1, 2019 2:57 AM
    Sunday, March 31, 2019 2:26 PM
  • O~ i seed it,

    In Win32_PnPEntity ManagementObjectCollection second item.

    StatusInfo:
    SystemCreationClassName:Win32_ComputerSystem
    SystemName:MY-PC
    Availability:
    Caption:Motherboard resources
    ClassGuid:{4d36e965-e325-11ce-bfc1-08002be10318}

    string ClassGuid = "";

    string query = "SELECT * from Win32_PnPEntity";

    using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
    {
    using (ManagementObjectCollection coll = searcher.Get())
    {
    try
    {
    foreach (ManagementObject resprinter in coll)
    {

    foreach (PropertyData property in resprinter.Properties)
    {                         

    ClassGuid += ((property.Name + ":" + property.Value) + Environment.NewLine);                

    }

    }
    }
    catch (ManagementException ex)
    {

    }
    }
    }

    • Marked as answer by LouisC27 Monday, April 1, 2019 2:55 AM
    Monday, April 1, 2019 2:55 AM

All replies

  • I am not sure what property you have looked at.

    C:\>wmic path Win32_PnPEntity where "PNPClass='cdrom'" get ClassGuid
    ClassGuid
    {4d36e965-e325-11ce-bfc1-08002be10318}



    Visual C++ MVP

    • Marked as answer by LouisC27 Monday, April 1, 2019 2:57 AM
    Sunday, March 31, 2019 2:26 PM
  • I am not sure what property you have looked at.

    C:\>wmic path Win32_PnPEntity where "PNPClass='cdrom'" get ClassGuid
    ClassGuid
    {4d36e965-e325-11ce-bfc1-08002be10318}



    Visual C++ MVP

    thank you for your reply but that result same like the "port " Class GUID, not a hardware GUID and also {4d36e965-e325-11ce-bfc1-08002be10318} cannot find in "Win32_PnPEntity "

    • Edited by LouisC27 Monday, April 1, 2019 1:45 AM
    Monday, April 1, 2019 1:43 AM
  • sorry what is your result of that query?

    What do you mean by port class guid? 

    If you are looking for hardware id you should not be posting that picture that highlights device class guid. The hardware id is a totally different property, and may not be in the form of guid. 

    I am not sure what query you wrote to find anything in Win32_PnPEntity (I am not even clear what are you looking for, see above). Post your WMI query. 



    Visual C++ MVP

    • Marked as answer by LouisC27 Monday, April 1, 2019 2:51 AM
    • Unmarked as answer by LouisC27 Monday, April 1, 2019 2:57 AM
    Monday, April 1, 2019 2:08 AM
  • O~ i seed it,

    In Win32_PnPEntity ManagementObjectCollection second item.

    StatusInfo:
    SystemCreationClassName:Win32_ComputerSystem
    SystemName:MY-PC
    Availability:
    Caption:Motherboard resources
    ClassGuid:{4d36e965-e325-11ce-bfc1-08002be10318}

    Monday, April 1, 2019 2:51 AM
  • sorry what is your result of that query?

    What do you mean by port class guid? 

    If you are looking for hardware id you should not be posting that picture that highlights device class guid. The hardware id is a totally different property, and may not be in the form of guid. 

    I am not sure what query you wrote to find anything in Win32_PnPEntity (I am not even clear what are you looking for, see above). Post your WMI query. 



    Visual C++ MVP

    謝你啦~ Thank you very much.
    • Edited by LouisC27 Monday, April 1, 2019 2:52 AM
    Monday, April 1, 2019 2:51 AM
  • O~ i seed it,

    In Win32_PnPEntity ManagementObjectCollection second item.

    StatusInfo:
    SystemCreationClassName:Win32_ComputerSystem
    SystemName:MY-PC
    Availability:
    Caption:Motherboard resources
    ClassGuid:{4d36e965-e325-11ce-bfc1-08002be10318}

    string ClassGuid = "";

    string query = "SELECT * from Win32_PnPEntity";

    using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
    {
    using (ManagementObjectCollection coll = searcher.Get())
    {
    try
    {
    foreach (ManagementObject resprinter in coll)
    {

    foreach (PropertyData property in resprinter.Properties)
    {                         

    ClassGuid += ((property.Name + ":" + property.Value) + Environment.NewLine);                

    }

    }
    }
    catch (ManagementException ex)
    {

    }
    }
    }

    • Marked as answer by LouisC27 Monday, April 1, 2019 2:55 AM
    Monday, April 1, 2019 2:55 AM