views:

63

answers:

1

Hi everyone,

I'm trying to create simple reports on Exchange 2010 mailbox size.

While this works:

Get-MailboxStatistics -server <serverfqdn> |ft  displayname, TotalItemSize

this doesn't (second column stays empty):

Get-MailboxStatistics -server <serverfqdn> |ft  displayname, {$_.TotalItemSize.Value.ToBytes()}

The problem is that I need the size as an integer, so the first line of code doesn't serve my purpose. According to several websites the second line of code should work but unfortunately doesn't on my machine.

I know I could parse the value after using the first line but that would be unnecessarily inefficient, wouldn't it? :-)

Hope anyone can help.

Regards, Kevin

A: 

Try this for your size expression:

@{expression={$_.TotalItemSize.Value.ToMB()};label="Mailbox Size(MB)"}

I believe there is also a ToKB() method.

Keith Hill
Hi Keith,unfortunately still nothing :-(I have tried quite a lot different approaches but it seems like .Value is always null/empty.
jarod1701
Are you sure TotalItemSize is not also empty? Try running $_ through Get-Member, then $_.TotalItemSize just to make sure you're working with the type of object you think you are.
Keith Hill
TotalItemSize contains proper values (e.g. "597.3 MB (626,268,748 bytes)").Great:Get-MailboxStatistics -identity mydomain\myuser | get-member -Name "TotalItemSize" returns "TotalItemSize Property System.String {get;set;}"So why is it that almost every sample code in the web is supposed to work but doesn't do so on my machine? :-)
jarod1701
Interesting - there is no "Value" property on the System.String type unless the Exchange snapin adds that member via the extended type system. Where you see TotalItemSize as a string, does the member list show 'Value'?
Keith Hill
Crap!I'm using implicit remoting on my local machine to script against Exchange 2010. TotalItemSize gets handeled as a string.When I use Exchange Management Shell on the Exchange Server itself, TotalItemSize is listed as Microsoft.Exchange.Data.Unlimited[...]Is there any way you know of to work with TotalItemSize using implicit remoting?
jarod1701