• How to get printer Properties using WMI

    Posted on January 28, 2013 by in Dotnet Tips & Tricks, Tips & Tricks

    public static void RetrievePrinterProperties()
    {
        //initialize the select query with command text
        SelectQuery query = new SelectQuery(@"SELECT * FROM Win32_Printer");
    
        //initialize the searcher with the query it is supposed to execute
        using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
        {
            //execute the query
            foreach (ManagementObject process in searcher.Get())
            {
                //print process properties
                Console.WriteLine("/*********Printer Properties ***************/");
                Console.WriteLine("{0}{1}", "Printer Name:", process["Name"]);
                Console.WriteLine("{0}{1}", "Is Printer Offline:", process["WorkOffline"]);
                Console.WriteLine("{0}{1}", "Local Printer:", process["Local"]);
            }
        }
    }
    

    printer Propertie
    List of Properties:

    Data Type Property Name
    uint32   Attributes
    uint32   Attributes
    uint16    Availability
    string    AvailableJobSheets[]
    uint32    AveragePagesPerMinute
    uint16    Capabilities[]
    string    CapabilityDescriptions[]
    string    Caption
    string    CharSetsSupported[]
    string    Comment
    uint32    ConfigManagerErrorCode
    uint32   ConfigManagerUserConfig
    string    CreationClassName
    uint16    CurrentCapabilities[]
    string    CurrentCharSet
    uint16    CurrentLanguage
    string    CurrentMimeType
    string    CurrentNaturalLanguage
    string    CurrentPaperType
    uint32   Default
    uint16    DefaultCapabilities[]
    uint32    DefaultCopies
    uint16    DefaultLanguage
    string    DefaultMimeType
    uint32    DefaultNumberUp
    string    DefaultPaperType
    uint32    DefaultPriority
    string    Description
    uint16    DetectedErrorState
    string    DeviceID
    uint32   Direct
    uint32   DoCompleteFirst
    string    DriverName
    uint32   EnableBIDI
    uint32   EnableDevQueryPrint
    uint32   ErrorCleared
    string    ErrorDescription
    string    ErrorInformation[]
    uint16    ExtendedDetectedErrorState
    uint16    ExtendedPrinterStatus
    uint32   Hidden
    uint32    HorizontalResolution
    datetime InstallDate
    uint32    JobCountSinceLastReset
    uint32   KeepPrintedJobs
    uint16    LanguagesSupported[]
    uint32    LastErrorCode
    uint32   Local
    string    Location
    uint16    MarkingTechnology
    uint32    MaxCopies
    uint32    MaxNumberUp
    uint32    MaxSizeSupported
    string    MimeTypesSupported[]
    string    Name
    string    NaturalLanguagesSupported[]
    uint32   Network
    uint16    PaperSizesSupported[]
    string    PaperTypesAvailable[]
    string    Parameters
    string    PNPDeviceID
    string    PortName
    uint16    PowerManagementCapabilities[]
    uint32   PowerManagementSupported
    string    PrinterPaperNames[]
    uint32    PrinterState
    uint16    PrinterStatus
    string    PrintJobDataType
    string    PrintProcessor
    uint32    Priority
    uint32   Published
    uint32   Queued
    uint32   RawOnly
    string    SeparatorFile
    string    ServerName
    uint32   Shared
    string    ShareName
    uint32   SpoolEnabled
    datetime StartTime
    string    Status
    uint16    StatusInfo
    string    SystemCreationClassName
    string    SystemName
    datetime TimeOfLastReset
    datetime UntilTime
    uint32    VerticalResolution
    uint32   WorkOffline
    Be Sociable, Share!
      Post Tagged with , , ,

    Written by

    View all articles by

    Email : [email protected]

    Leave a Reply