Solved

Full view in export of format-table

Posted on 2011-03-23
7
714 Views
Last Modified: 2012-05-11
I want to run a Powershell command to export some information into a table.

get---xxx | get-yyyy| ft name, attribute1 > c:\info.csv

Unfortunately, the export seems to be cropped. I've tried -autosize, but then I get a message saying that yyyy was too large to fit into the display.

Since I am exporting to a CSV, does anyone know how I can force Powershell to export ALL the info?
0
Comment
Question by:kam_uk
  • 3
  • 3
7 Comments
 
LVL 13

Accepted Solution

by:
soostibi earned 250 total points
ID: 35202862
Instead of ft, do this:

get---xxx | get-yyyy| select-object name, attribute1 | export-csv c:\info.csv

0
 
LVL 69

Assisted Solution

by:Qlemo
Qlemo earned 250 total points
ID: 35202872
You should use export-csv instead of format-table for that purpose. format-table is intended for output onto screen.
0
 
LVL 3

Author Comment

by:kam_uk
ID: 35203488
Thanks, the reason I wanted format table is because I wanted to see it in table format, with each entry on a different line...can I still do this with export-csv? I thought the ">" meant the same as export-csv?

Secondly, I'd like to sort by one of the attributes (attribute1), e.g. alphabetically lowest to highest, do you know how I would do this?
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 69

Expert Comment

by:Qlemo
ID: 35203523
get---xxx | get-yyyy| sort-object attribute1 | select-object name, attribute1 | export-csv c:\info.csv

And no, format-table >    is not the same as export-csv. The latter formats the output appropriate for CSV, while format-table is used to display like in a table - on the screen, but not in a file.
0
 
LVL 13

Expert Comment

by:soostibi
ID: 35204976
Then you can do this, but not a CSV, but a simple text file:
get---xxx | get-yyyy| sort-object attribute1 | select-object name, attribute1 | out-file c:\info.txt

You can even override the width by:
get---xxx | get-yyyy| sort-object attribute1 | select-object name, attribute1 | out-file c:\info.txt -width 800



0
 
LVL 69

Expert Comment

by:Qlemo
ID: 35205159
Why not using export-csv, soostibi?
0
 
LVL 13

Expert Comment

by:soostibi
ID: 35205305
You said, that you want to see the same in the file as in the screen. CSV is a different format, it organizes data by commas (Comma Separated Values), so it will never be like the data on the screen.

You might change the separator to TABs, it will be more similar:

get---xxx | get-yyyy| sort-object attribute1 | select-object name, attribute1 | export-csv c:\info.csv -delimiter "`t"
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

806 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