Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Publicfolderstatistics result is not displayed correctly in CSV.

Posted on 2016-08-19
6
Medium Priority
?
63 Views
Last Modified: 2016-08-22
I am running a get-publicfolderstatistics in Exchange Management Shell to list a couple of properties of each Public Folder.  The result is returned as expected.  

I then run the same command again and pipe the result to a CSV file, I see the result differently - please see the attached.  
Public Folder StatisticsPlease advise how to fix this.  

Thanks,
0
Comment
Question by:nav2567
  • 3
  • 2
6 Comments
 
LVL 71

Expert Comment

by:Qlemo
ID: 41763575
You did several typical beginner's mistakes:
  • Piping format-* cmdlet output to a file. That does not work - that formatting is intended only for display in the console screen. You can make it work to create a plain text output, but that is not the what you should do.
  • Considering a CSV file to be an Excel file. That's wrong. CSV is a structured text file containing multi-column data with delimiters. Excel uses binary formats.
  • Posting a screenshot as attachment, and not using the "embed" feature, so we do not see it unless we download. I've changed that already (being a Topic Advisor, I'm able to edit questions).
First attempt usually is to really export to CSV, but on screen, to see what you would get:
<# your code generating output #> | Select <# list of columns you want to keep #> | ConvertTo-CSV -NoType

Open in new window

You can leave out the Select if you do not want to modify which columns to see.
If that works, you just replace ConvertTo-CSV -NoType by Export-CSV -NoType <# path and file name #>.

The most simple line is:
Get-PublicFolderStatistics | Export-CSV -NoTYpe C:\Temp\EE\PublicFolderStats.csv

Open in new window

0
 

Author Comment

by:nav2567
ID: 41763662
I tried as you said before creating this question:
Get-PublicFolderStatistics | Export-CSV -NoTYpe C:\Temp\EE\PublicFolderStats.csv.

Get-PublicFolderStatistics is fine.
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 41763684
Well, I tried too, and my results are fine. Your screenshot is doubtless the result of using format-table.
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 

Author Comment

by:nav2567
ID: 41764214
The reason I am using FT is because I need to list certain pieces of information in the statistics.

get-publicfolderstatistics -resultsize unlimited | ft creationtime,lastaccesstime,.....

Without ft being specified, my parameters will not be recognized.  

Thanks.
0
 
LVL 71

Accepted Solution

by:
Qlemo earned 2000 total points
ID: 41764260
As I've told, you use Select-Object instead.
0
 
LVL 84

Expert Comment

by:David Johnson, CD, MVP
ID: 41764654
@Qlemo: a long week?
$stats = get-publicfolderstatistics -resultsize unlimited |  select-object creationtime,lastaccesstime,andothers
$stats | format-table
$stats | Export-CSV -NoTypeInformation C:\Temp\EE\PublicFolderStats.csv.

Open in new window

0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

Steps to fix “Unable to mount database. (hr=0x80004005, ec=1108)”.
Stellar Exchange Toolkit: this 5 in 1 toolkit comes loaded with mega-software tool. Here’s an introduction to tools’ usage and advantages:
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
how to add IIS SMTP to handle application/Scanner relays into office 365.

773 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