Exchange export to CSV does not populate all feilds

Following command will not populate 'TotalitemSizesMB'

Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName, IssueWarningQuota, ProhibitSendQuota, @{label="TotalItemSize(MB)";expression={(Get-MailboxStatistics $_).TotalItemSize.Value.ToMB()}}, @{label="ItemCount";expression={(Get-MailboxStatistics $_).ItemCount}}, Database | Export-Csv "C:\UserMailboxSizes.csv" -NoTypeInformation
LVL 6
DeepinInfrastructure Engineer Asked:
Who is Participating?
 
Guy LidbetterCommented:
@Kiss sky - It will report anything below 1MB it will just round up or down (i.e. report a 1 or a 0)

@Deepin - try opening an Admin Powershell and running this

Add-PsSnapin *2010
Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName, IssueWarningQuota, ProhibitSendQuota, @{label="TotalItemSize(MB)";expression={(Get-MailboxStatistics $_).TotalItemSize.Value.ToMB()}}, @{label="ItemCount";expression={(Get-MailboxStatistics $_).ItemCount}}, Database | Export-Csv "C:\UserMailboxSizes.csv" -NoTypeInformation

Open in new window

0
 
Guy LidbetterCommented:
Try replacing it with this...

@{Label="TotalItemSize";Expression={$MBXSize = Get-Mailboxstatistics $_.Name; $MBXSize.totalItemSize.value.toMB()}}

Open in new window

0
 
DeepinInfrastructure Engineer Author Commented:
Just tried replacing with the line you mentioned - see full command below . Same result


Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName, IssueWarningQuota, ProhibitSendQuota, @{Label="TotalItemSize";Expression={$MBXSize = Get-Mailboxstatistics $_.Name; $MBXSize.totalItemSize.value.toMB()}}, @{label="ItemCount";expression={(Get-MailboxStatistics $_).ItemCount}}, Database | Export-Csv "C:\UserMailboxSizes.csv" -NoTypeInformation
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
Guy LidbetterCommented:
That's odd - I just ran your original script and its populating fine for me...

Is the field empty or not what your were expecting???
0
 
DeepinInfrastructure Engineer Author Commented:
the fields empty both Total Item sizes and Item Count, I've tried that particular script on two server - both with the same out come

both on Exchange 2010
0
 
Guy LidbetterCommented:
On both versions of the script, I got both fields populated... this is with 2010 as well.

Sorry Deepin... as far as I can see everything works as expected...

Where are you running the script? in powershell with the E2010 add-in or in the EMS?? or Powershell ISE???
0
 
DeepinInfrastructure Engineer Author Commented:
hmmmm.....Exchange management Console
0
 
Minecraft_ EndermanCommented:
One thing to remember, if the TotalitemSizes of mailbox is less than 1 MB, then this script will not report.
You can run this command to check this
Get-mailbox -resultsize 20 | Get-MailboxStatistics | fl TotalItemSize
And I can be sure that there is no problem with this command.
0
 
DeepinInfrastructure Engineer Author Commented:
Brilliant!! what works from Admin Powershell but not from EMC

thanks for your help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.