Solved

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

Posted on 2013-12-16
8
3,355 Views
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.
0
Comment
Question by:mjm21
  • 4
  • 3
8 Comments
 
LVL 12

Expert Comment

by:piattnd
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

0
 
LVL 53

Accepted Solution

by:
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...

Server
PrintServer1
PrintServer2
etc...

$Printers = import-csv "c:\youCSVhere.csv"
foreach ($Printer in $Printers) {
$Printer.Server
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

Will.
0
 

Author Comment

by:mjm21
ID: 39722343
Ok - thanks will test in a few....
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Author Comment

by:mjm21
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
0
 
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

Will.
0
 

Author Comment

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

 -ComputerName $Printer.Server
0
 
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.

Will.
0
 

Author Comment

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

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…

777 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