Solved

Publicfolderstatistics result is not displayed correctly in CSV.

Posted on 2016-08-19
6
47 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 69

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 69

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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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 69

Accepted Solution

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

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

770 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