Hi
I’m using Exchange 2010, and want to list our 30 largest mailboxes. I know little about Powershell, but my Google search tells me this is the only way. So I would have to run a Powershell command
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,TotalItemSize -First 30
So I logged onto the mail server, opened the Powershell window and tried the command. But then I get a message
The term ‘Get-Mailbox’ is not recognized as the name of a cmdlet, function, script file, or operable program
Is there a step I must run first to get Powershell commands to run? Or better stilll, can I do this without using Powershell?
Thanks
2 Spice ups
Just tried that, same error message.
I just opened the Powershell window from the taskbar, and pasted in the command. Its a while since I used Powershell, but I thought that was all you had to do.
You need to be running EMS, http://blogs.interfacett.com/how-to-run-the-exchange-management-shell-ems-in-powershell
Here’s the command I use for list all mailboxes by size, delted items and message counts
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select DisplayName,StorageLimitStatus,@{name=“TotalItemSize (MB)”;expression={[math]::Round((($.TotalItemSize.Value.ToString()).Split(“(”)[1].Split(" “)[0].Replace(”,“,”")/1MB),2)}},@{name=“TotalDeletedItemSize (MB)”;expression={[math]::Round((($.TotalDeletedItemSize.Value.ToString()).Split(“(”)[1].Split(" “)[0].Replace(”,“,”")/1MB),2)}},ItemCount,DeletedItemCount | Sort “TotalItemSize (MB)” -Descending | Export-CSV “C:\All Mailboxes.csv” -NoTypeInformation
2 Spice ups
Hmm, formatting messed up, let me try it as an attachment
mailbox_size.txt (523 Bytes)
You are probably running regular powershell when you need to be running Exchange Management Shell (or import the correct modules). Powershell command works perfectly, just ran it myself using the Exchange Management Shell.
Ah, I wasn’t running EMS. I was using the standard Powershell. Thanks to mattroberts link above, I clicked Exchange Management Shell/Run as Administrator. Then the commands ran fine.

1 Spice up
Wasn’t sure if you had EMS, hence the link to how to make PS run EMS - glad you got it all working