Using the PowerShell `Get-PrinterProperty
` cmdlet, it gets one or more printer properties for a specified printer.
Here is the PowerShell command to get printer properties.
Get-PrinterProperty -PrinterName "Printer_RICOH_A"
In this article, I will explain how to get printer properties like Collate, Color, DuplexingMode, Driver version details, and many more printer properties using PowerShell.
PowerShell – Get Printer Properties
Using PowerShell Get-PrinterProperty to retrieve printer properties. You can use the Get-PrinterProperty
cmdlet to get printer properties in the Windows PowerShell remoting session.
PowerShell Tip: Use administrator credentials to run Get-PrinterProperty cmdlet.
Cmdlet: Get-PrinterProperty
Description: Retrieve printer properties for the specified printer
Syntax:
Get-PrinterProperty [[-PropertyName] <String[]>] [-ComputerName <String>] [-PrinterName] <String> [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [<CommonParameters>]
Let’s understand using the PowerShell Get-PrinterProperty cmdlet to get printer properties using different examples as given below.
PowerShell Get Printer Properties for Specific Printer
To get printer properties for a specific printer, run the below command
PS C:\> Get-PrinterProperty -PrinterName "Printer_RICOH_A"
In the above example, the Get-PrinterProperty
command gets the printer properties for a specific printer specified by the PrinterName
parameter. The PrinterName
parameter specifies the printer name from which you want to retrieve the printer properties.
PowerShell Tip: Use the ErrorAction variable to handle errors in PowerShell!
Get Printer Properties for Remote Machine
To get printer properties for the remote machines, use the PowerShell Get-PrinterProperty cmdlet. This command will retrieve the printer properties such as printername, computername, propertyname, type, and value.
PS C:\> Get-PrinterProperty -ComputerName CORP-IN-18 -PrinterName "Printer_RICHOH_A" ComputerName PrinterName PropertyName Type Value ------------ ----------- ------------ ---- ----- CORP-IN-18 Priter_RICHOH_A FormTrayTable String
In the above example, the PowerShell Get-PrinterProperty cmdlet has the -ComputerName
parameter. Using the Computer name and printer name specified by the -PrinterName
parameter, it retrieves printer properties.
PowerShell Tip: How to get printer serial numbers using PowerShell!
Get Printer Properties for all installed Printers
To get printer properties for all installed printers on the computer ( local or remote machine), we can use the PowerShell Get-Printer cmdlet to get a list of printers, and using Get-PrinterProperty it will loop over each printer to get printer property as given in the below example.
PS C:\>$printers = Get-Printer * foreach ($printer in $printers) { Get-PrinterProperty -PrinterName $printer.name }
In the above example, the command Get-Printer * gets all printers and stores it in $printers
variable.
Using Foreach
loop, it iterates over each printer and gets printer properties by specified $printer.name
PowerShell Tip: How to add a new line to a string or variable?
PowerShell Get Printer Property using PropertyName
To get printer property, using the PowerShell Get-PrinterProperty cmdlet, it has the -PropertyName parameter. It retrieves property specified by PropertyName.
PS C:\> Get-PrinterProperty -ComputerName CORP-IN-18 -PrinterName "Printer_RICHO_A" -PropertyName FormTrayTable ComputerName PrinterName PropertyName Type Value ------------ ----------- ------------ ---- ----- CORP-IN-18 Printer_RICHO_A FormTrayTable String
In the above example, we specify FormTrayTable
property in the –PropertyName parameter.
PowerShell Tip: Using PowerShell script to restart Print Spooler Service!
Get-PrintrProperty Parameters
-AsJob – Use this parameter to run the command as a background job. Use this parameter to run the command in the background if it is taking a long time. It can be more useful while getting printer properties for remote machines in PowerShell.
–CimSession – This parameter runs the GetPrinterProperty cmdlet in a remote computer or remote session.
-ComputerName – Use this parameter to specify the computer name from which GetPrinterProperty cmdlet will get printer properties.
-PrinterName – Use this parameter to specify the printer name from which to retrieve printer properties.
-PropertyName – Use this parameter to specify printer property to get property. wildcard characters do not work with this cmdlet and parameter.
-ThrottleLimit – This parameter specifies the maximum number of concurrent operations that can be established to run the cmdlet.
Conclusion
I hope you find the above article on using the PowerShell Get-PrinterProperty cmdlet to get one or more printer properties useful and educational.
Use Get-Printer * to get all printers installed on the computer, and loop over each printer to get printer property. Note, that you can not use wildcard characters with PowerShell Get-PrinterProperty.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.