Solved

Full view in export of format-table

Posted on 2011-03-23
7
718 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
[X]
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
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adding a countdown to HTA 12 98
Export Exchange 2007 Export Shared Mailboxes list 3 20
add error checking to powershell script 2 15
Ruby or Python 7 60
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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