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....
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

730 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