Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Full view in export of format-table

Posted on 2011-03-23
7
716 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
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

 
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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