mjm21
asked on
Powershell / Quest Commandlets Script to get all printers in the domain
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok - thanks will test in a few....
ASKER
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], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nError,Mic rosoft.Pow erShell.Co mmands.Get WmiObjectC ommand
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], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
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.
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.
ASKER
I have tested with single name with above script worked....but something wrong with this:
-ComputerName $Printer.Server
-ComputerName $Printer.Server
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.
Will.
ASKER
Yes - that's was the problem. Did not put server in the heading. Many thanks!
Open in new window