Solved

Publicfolderstatistics result is not displayed correctly in CSV.

Posted on 2016-08-19
6
49 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 80

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
This article explains how to install and use the NTBackup utility that comes with Windows Server.
To show how to create a transport rule 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 Mail Flow >> Rules tab.:  To cr…
To show how to generate a certificate request 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 Servers >> Certificates…

808 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