Solved

Full view in export of format-table

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

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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 68

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 68

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Why would I want to create a function for tracking messages? I am glad you asked. As with most monotonous/routine tasks, human error tends to creep in after doing the same task over and over again. By creating a function, you load the function once…
This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now