get network printer information using powershell command.

nav2567
nav2567 used Ask the Experts™
on
Hello,

I am using the following command to get printers information on my print server.

Get-WmiObject win32_printer -computer PRINTSVR1 | ? { $_.type -ne 1 } | sort name | ConvertTo-html -prop Name,DriverName,PortName,Location > c:\printsvr1.html

It works.  However, I am trying to make the output in excel format.  How do I tweak that command to do that?

Please advise.  

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I would say that your translating to hmtl so remove the convert to and use  Export-Csv C:\MyFile.Csv

Author

Commented:
It doesnt work.
... or perhaps use ConvertTo-CSV

I don't think that there is anything to convert to XLS (or XLSX) format (other than Excel).
Get-WmiObject win32_printer -computer PRINTSVR1 | ? { $_.type -ne 1 } | sort name | ConvertTo-CSV -prop Name,DriverName,PortName,Location > c:\printsvr1.csv


I think dans dad would be like this. my way would be to remove the convert to and change the file path to .csv and use exportTo-CSV

I believe that both should work for you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial