How to List Printers Using PowerShell?

In this tutorial, I will explain how to list printers using PowerShell. Whether you’re an IT professional or a system administrator, you should know how to use PowerShell to get printers.

List Printers Using PowerShell Get-Printer Cmdlet

In PowerShell, the Get-Printer cmdlet is used to list all printers installed on a computer. This cmdlet is part of the PrintManagement module, which is available on Windows Server 2012 and later versions. Here’s how you can use it:

Example 1: List All Printers on a Local Machine

To list all printers on your local machine, open PowerShell with administrative privileges and run the following command:

Get-Printer

This command retrieves a list of all printers installed on the local machine, displaying essential details such as the printer name, status, and type.

I executed the above PowerShell cmdlet, and you can see the exact output in the screenshot below:

List Printers Using PowerShell

Check out Get a List of Installed Programs Using PowerShell

Example 2: List Specific Printer Properties

If you need more detailed information about a specific printer, you can use the Get-Printer cmdlet with additional parameters. For example, to get properties of a printer named “HP LaserJet Pro MFP M428fdw,” run:

Get-Printer -Name "HP LaserJet Pro MFP M428fdw"

This command returns detailed information about the specified printer, including its status, location, and capabilities.

Using WMI to List Printers

Windows Management Instrumentation (WMI) is another powerful method to interact with printers. The Win32_Printer class provides comprehensive details about printers on a system. Here’s how to use it:

Example 3: List All Printers Using WMI

To list all printers using the Win32_Printer class, run the following command:

Get-WmiObject -Query "SELECT * FROM Win32_Printer"

This command retrieves a list of all printers, displaying detailed information such as printer name, status, and location.

Example 4: Filter Printers by Status

You can also filter printers by their status using WMI. For example, to list only printers that are currently online, run:

Get-WmiObject -Query "SELECT * FROM Win32_Printer WHERE PrinterStatus = 3"

In this query, PrinterStatus = 3 indicates that the printer is online.

Read List All Environment Variables in PowerShell

List Network Printers using PowerShell

In many organizations, printers are shared over a network. PowerShell can help you list network printers efficiently.

Example 5: List Network Printers on a Remote Machine

To list network printers on a remote machine named “Server01,” use the following command:

Invoke-Command -ComputerName "Server01" -ScriptBlock { Get-Printer }

This command executes the Get-Printer cmdlet on the remote machine and returns the list of printers.

Example 6: List Printers in Active Directory

If your organization uses Active Directory (AD) to manage printers, you can list printers registered in AD using PowerShell. Here’s how:

Get-ADObject -Filter 'objectClass -eq "printQueue"' -Property Name, Location, ServerName

This command retrieves printer objects from Active Directory, displaying their names, locations, and server names.

Check out List USB Devices Using PowerShell

Printer Management with PowerShell

You can also use PowerShell to add or remove printers.

Example 7: Add a New Printer

To add a new printer named “HP OfficeJet Pro 9025” on a remote machine “Server01,” use the following command:

Invoke-Command -ComputerName "Server01" -ScriptBlock {
    Add-Printer -Name "HP OfficeJet Pro 9025" -DriverName "HP OfficeJet Pro 9025" -PortName "IP_192.168.1.100"
}

This command adds a new printer with the specified name, driver, and port on the remote machine.

Example 8: Remove an Existing Printer

To remove an existing printer named “HP LaserJet Pro MFP M428fdw” on a remote machine “Server01,” run:

Invoke-Command -ComputerName "Server01" -ScriptBlock {
    Remove-Printer -Name "HP LaserJet Pro MFP M428fdw"
}

This command removes the specified printer from the remote machine.

Check out List Local Administrators Using PowerShell

Troubleshooting Issues Related to Printers

You might encounter some common issues while working with PowerShell to manage printers. Here are a few troubleshooting tips:

Issue 1: Access Denied

If you receive an “Access Denied” error, ensure you have administrative privileges on the local or remote machine. Run PowerShell as an administrator and check your permissions.

Issue 2: Printer Not Found

If a printer is not found, verify the printer name and ensure it is correctly installed on the machine. Use the Get-Printer cmdlet to list all available printers and confirm the name.

Issue 3: Network Connectivity

For network printers, ensure the remote machine is reachable, and the network connection is stable. Use the Test-Connection cmdlet to check connectivity:

Test-Connection -ComputerName "Server01"

This command pings the remote machine to verify network connectivity.

Conclusion

In this tutorial, I explained how to list printers using PowerShell. You can use the Get-Printer PowerShell cmdlet to get all printers in your local system, or you can use the Get-WmiObject cmdlet to list printers.

Do let me know in the comment below if this tutorial helps you.

You may also like:

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.