Powershell / Quest Commandlets Script to get all printers in the domain

Posted on 2013-12-16
Last Modified: 2013-12-17
Powershell / Quest Commandlets Script for all printers in the domain.  Would like to list all network printers in the domain and export to .csv file.
Question by:mjm21
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 12

Expert Comment

ID: 39722035
Give the following command a try, though it is listed as being a command for Server 2012 and Windows 8.

Get-Printer -ComputerName SERVERNAME | ? published

Open in new window

LVL 53

Accepted Solution

Will Szymkowski earned 500 total points
ID: 39722156
You can accomplish this by using the following command below...

For the below script to work you will need to get a list of all print servers and put it into a CSV file. The format should be like below...


$Printers = import-csv "c:\youCSVhere.csv"
foreach ($Printer in $Printers) {
Get-WmiObject -Class Win32_Printer -ComputerName $Printer.Server | Select SystemName, ShareName, Name, Location | Export-csv "c:\exportedPrinters.csv

Open in new window

Results will be in a CSV file called ExportedPrinters.csv


Author Comment

ID: 39722343
Ok - thanks will test in a few....
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.


Author Comment

ID: 39722505
Getting Error:  Get-WmiObject : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Supply an argument that is not null or empty an
d then try the command again.
At line:4 char:49
+ Get-WmiObject -Class Win32_Printer -ComputerName <<<<  $Printer.Server | Select SystemName, ShareName, Name, Location | Export-csv "c:\exportedPri
nters.csv" }
    + CategoryInfo          : InvalidData: (:) [Get-WmiObject], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetWmiObjectCommand
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39722521
That error above is due to the CSV file it is reading. Make sure that it has the appropriate name structure.

You can test this with one individual computer name see below...

Get-WmiObject -Class Win32_Printer -ComputerName <namehere> | Select SystemName, ShareName, Name, Location | Export-csv "c:\exportedPrinter.csv


Author Comment

ID: 39722676
I have tested with single name with above script worked....but something wrong with this:

 -ComputerName $Printer.Server
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39722815
You need to make sure that your CSV file is constructed like I have illustrated above. In column A you need Server as the heading and all of the server names below. I have tested this in my environment and it works.


Author Comment

ID: 39723931
Yes - that's was the problem.  Did not put server in the heading.  Many thanks!

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question