Solved

Publicfolderstatistics result is not displayed correctly in CSV.

Posted on 2016-08-19
6
41 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 68

Expert Comment

by:Qlemo
Comment Utility
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
Comment Utility
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 68

Expert Comment

by:Qlemo
Comment Utility
Well, I tried too, and my results are fine. Your screenshot is doubtless the result of using format-table.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:nav2567
Comment Utility
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 68

Accepted Solution

by:
Qlemo earned 500 total points
Comment Utility
As I've told, you use Select-Object instead.
0
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
Comment Utility
@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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
Synchronize a new Active Directory domain with an existing Office 365 tenant
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…

743 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

16 Experts available now in Live!

Get 1:1 Help Now