1

I can get the size of a mailbox using Get-MailboxStatistics. How do I find the difference between two mailbox sizes using Powershell?

I tried:

(Get-MailboxStatistics FordPrefect).totalitemsize - (Get-MailboxStatistics ArthurDent).totalitemsize

which results in the error:

Method invocation failed because [System.ManagementAutomation.PSObject] doesn't contain method named 'op_Subtraction'

which is kinda correct as the totalitemsize object does not have the subtraction method/member. How do I then proceed further with the operation?

Slartibartfast
  • 703
  • 6
  • 8
  • If you want to get all users information, you could use the following command to export to a csv file: `Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | ft DisplayName,TotalItemSize | out-file c:\user.csv` – Shaw Lu Feb 18 '19 at 03:16

1 Answers1

3

TotalItemSize is not a number, the property has two members:

[PS] C:\Windows\system32>(Get-MailboxStatistics administrator).totalitemsize

IsUnlimited Value
----------- -----
      False 690.4 KB (706,925 bytes) 

This should work:

(Get-MailboxStatistics FordPrefect).totalitemsize.Value - (Get-MailboxStatistics ArthurDent).totalitemsize.Value