Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Formating

$
0
0

I've discovered that formatting is sort of a pain for me.   I have this code that works and returns the information I need.

 

$printers = Get-WmiObject -computer mgmg17ps -class "win32_printer" | select *

 

#Foreach printer in $printers list, write output to csv file

foreach ($printer in $printers)

{

$server = $printer.pscomputername

$name = $printer.name

$driver = $printer.drivername

$comment = $printer.comment

$location = $printer.location

$ip = $printer.portname

"$server,$name,$driver,$comment,$location,$ip" >> "c:\temp\printers.csv"

 

but the output places all of the data on one line.  So in Excel column A1 has each piece of data.   How do I make this so each piece of data is in it's own column?  

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles