Need some help in modifying Exchange PowerShell to list top 10 mailbox usage in two separate MBX server ?

Hi All,

Can anyone here please assist me to combine or fix the below pwoershell script to be able to display the Top 10 largest mailbox users in GB ?

 Get-MailboxServer | Get-MailboxStatistics | sort-object -descending totalItemSize | Select -First 10 | ft -autosize DisplayName, @{expression={$_.totalitemsize.value.ToMB()};label="Mailbox Size(MB)"}, itemcount, lastlogontime 

Open in new window


There are two separate mailbox server therefore I use the Powershell command Get-MailboxServer to capture both of them, but somehow it does not work ?
LVL 9
Senior IT System EngineerIT ProfessionalAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Todd NelsonConnect With a Mentor Systems EngineerCommented:
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,@{label="TotalItemSize (GB)";expression={$_.TotalItemSize.Value.ToGB()}},ItemCount,LastLogonTime -First 10 | Export-Csv C:\MailboxSizes.csv -NoTypeInformation

Open in new window

2
 
AntzsConnect With a Mentor Infrastructure ServicesCommented:
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,totalitemcount,lastlogontime,TotalItemSize -First 10
1
 
Senior IT System EngineerIT ProfessionalAuthor Commented:
Thanks Anthony,

So how can I list the mailbox size in Gigabyte ?
0
Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

 
Senior IT System EngineerIT ProfessionalAuthor Commented:
THanks Todd and Anthony,

Somehow the TotalItemSize (GB) is not working ?
all of the other columns are shown, only th size is not shown both in the console and on the .CSV file ?
0
 
AntzsInfrastructure ServicesCommented:
Without any additional switches, it is already showing the size in GB.

exchange.png
0
 
Senior IT System EngineerIT ProfessionalAuthor Commented:
Hm.. that's odd.

Somehow mine only showing the ItemCount column not the size.
0
 
AntzsInfrastructure ServicesCommented:
If you are you using Exchange 2010, try looking at the below link.

https://blogs.technet.microsoft.com/heyscriptingguy/2013/02/27/get-exchange-online-mailbox-size-in-gb/

I am using Exchange 2013.
1
 
Senior IT System EngineerIT ProfessionalAuthor Commented:
Ah yes,

I'm using Exchange 2010.
0
 
Senior IT System EngineerIT ProfessionalAuthor Commented:
It is still not working ?

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,@{label="TotalItemSize (GB)";expression={$_.TotalItemSize.ToString().Value.ToGB()}},ItemCount,LastLogonTime -First 10

same result as before.
0
 
AntzsInfrastructure ServicesCommented:
Have a go at this.  Sorry, I don't have an Exchange 2010 to test on.

https://www.petri.com/getting-mailbox-sizes-in-powershell
1
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.