Tuesday, October 22, 2013

PowerShell Tip : Find Default Printer Installed using Powershell.


The job of System Administrators are very adventurous, sometime you have to find a little-little settings and sometime you have to write a big-big,  hundred’s of line’s scripts.

Today, my task was to find a default printer installed on laptops. To solve it , i used the Win32_Printer class.

You can run the below query on your laptop and this will show you the default installed  printer on your system.

To run the below command on the remote system you can –Computer parameter and make sure you are proper admin rights to access the system.

We are using Get-WmiObject cmdlet and then we are running a WQL query to select everything from Win32_Printer class and choose to show that result where default value is true.


Get-WmiObject -Query " SELECT * FROM Win32_Printer WHERE Default=$true"

21-10-2013 17-53-29

If you want to see all printers installed on your laptop, you can run the below code and this will show you the list of all printers,  with their Port Name and location.

Get-WmiObject -Query " SELECT * FROM Win32_Printer" | Select Name, Default, PortName,Location

21-10-2013 13-53-47

I love WMI .

Happy learning . ;o) .

Tested on : Windows7 [64 bit]

Aman Dhally
clip_image001 clip_image002 clip_image003 clip_image005  clip_image007


  1. In a domain with some computers, is it possible to get all default printer with this PS command?

  2. How to run this command for remote pc

  3. Please share syntax to run these commands in domain

  4. This can become quite a bit shorter with a couple small changes:
    1) Get-Wmi-Object has an alias gwmi
    2) instead of writing out your whole query -Query "SELECT * FROM Win32_Printer" you can just use Win32_Printer

    So you end up with:
    gwmi win32_printer | WHERE {$_.Default -eq $True}
    gqmi Win32_Printer | Select Name, Default, PortName, Location


Note: Only a member of this blog may post a comment.