Problem
You want to get information about printers on the current system.
Solution
To retrieve information about printers attached to the system, use the Win32_Printer WMI class:
PS >GetWmiObject Win32_Printer | SelectObject Name,PrinterStatus
Name
PrinterStatus
Microsoft Office Document Image Wr...
3
Microsoft Office Document Image Wr...
3
CutePDF Writer
3
Brother DCP1000
3
To retrieve information about a specific printer, apply a filter based on its name:
PS >$device = GetWmiObject Win32_Printer Filter "Name='Brother DCP1000'" PS >$device | FormatList *
Status : Unknown Name : Brother DCP1000 Attributes : 588 Availability : AvailableJobSheets : AveragePagesPerMinute : 0 Capabilities : {4, 2, 5} CapabilityDescriptions : {Copies, Color, Collate} Caption : Brother DCP1000 (...)
To retrieve specific properties, access as you would access properties on other PowerShell objects:
PS >$device.VerticalResolution 600 PS >$device.HorizontalResolution 600
Discussion
The example in the solution uses the Win32_Printer WMI class to retrieve information about installed printers on the computer. While the Win32_Printer class gives access to most commonly used information, WMI supports several other printerrelated classes: Win32_TCPIPPrinterPort, Win32_PrinterDriver, CIM_Printer, Win32_PrinterConfiguration, Win32_PrinterSetting, Win32_PrinterController, Win32_PrinterShare, and Win32_PrinterDriverDll.