Solved

Exchange 2013 Powershell Command Help

Posted on 2016-09-19
11
50 Views
Last Modified: 2016-09-29
Hello,
I have a specific Exchange 2013 database that has unlimited size restrictions. I would like to run a Powershell script that would look at ONLY that database and give me a list of the biggest mailboxes in descending order.  I've tried a couple of different get-mailbox commands and it's not working out perfectly.

Can you please help?
Thanks in advance.
0
Comment
Question by:zito2000
  • 3
  • 3
  • 2
  • +3
11 Comments
 
LVL 18

Expert Comment

by:suriyaehnop
Comment Utility
Try use this powershell from microsoft gallery

https://technet.microsoft.com/en-us/library/bb124612(v=exchg.160).aspx
0
 
LVL 24

Expert Comment

by:-MAS
Comment Utility
Hi,
Please try the below command
Get-Mailbox | Get-MailboxStatistics | select displayname,TotalItemSize | Sort-Object TotalItemSize -Descending

Open in new window


This is for single database
Get-Mailbox -database database1 | Get-MailboxStatistics | select displayname,TotalItemSize | Sort-Object TotalItemSize -Descending

Open in new window


Hope it helps
1
 

Author Comment

by:zito2000
Comment Utility
I've attempted all of these commands, but not getting great results unfortunately.  
This command:
Get-MailboxStatistics -Database "Database1"

Gives me a list of mailboxes and item count, but not size.  I'm thinking we could add something to this command to show the size...!?
0
 
LVL 49

Assisted Solution

by:Akhater
Akhater earned 150 total points
Comment Utility
Get-Mailbox -ResultSize unlimited -Database "UnlimitedDB" | Get-MailboxStatistics | select-object Displayname, @{expression = {$_.TotalItemSize.Value.ToMB()};label="TotalItemSizeMB"} | sort TotalItemSizeMB -Descending 

Open in new window


if the above doesn't work for you give us the output to be able to help
1
 
LVL 68

Accepted Solution

by:
Qlemo earned 350 total points
Comment Utility
Get-MailboxStatististics -Database Database1 | select-object Displayname, @{ n = 'TotalItemSizeMB'; e = {$_.TotalItemSize.Value.ToMB()} } | sort TotalItemSizeMB -Descending 

Open in new window

You need to enumerate the properties you want to get in the output, as the default formatting is not displaying the size and much more. The explicit extraction of the size is recommended because you get a complex object (with sizes in Bytes, GB etc.) otherwise, with no useful default formatting IMHO.
1
The problems with reply email signatures

Do you wish that you could place an email signature under a reply? Well, unfortunately, you can't. That great Exchange/Office 365 signature you've created will just appear at the bottom of an email chain. What a pain! Is there really no way to solve this? Well, there might be...

 

Author Comment

by:zito2000
Comment Utility
Well this just shifted gears...I ran the command that Akhater described and when I press <enter> it just goes to the next line.  No error, nothing.  I've tried this command on 2 different mailbox servers and tried querying multiple mailbox databases and the same result.  That is bizarre.  See screen shot.  Thoughts?
Commands.png
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
Certain there are mailboxes in that database? You should be, as you got results earlier.
Try my more direct suggestion, please.
0
 
LVL 49

Expert Comment

by:Akhater
Comment Utility
since you said that Get-MailboxStatistics -Database "Database1" gave back results I am not sure why my command didn't work for you but you could just skip the first part and convert it to the below which would be very much the same as what Qlemo proposed


Get-MailboxStatistics -Database "Database1" | select-object Displayname, @{expression = {$_.TotalItemSize.Value.ToMB()};label="TotalItemSizeMB"} | sort TotalItemSizeMB -Descending 

Open in new window

0
 

Author Comment

by:zito2000
Comment Utility
Thanks Qlemo, your solution worked.  Yes, there are mailboxes in there and your command:
Get-MailboxStatististics -Database Database1 | select-object Displayname, @{ n = 'TotalItemSizeMB'; e = {$_.TotalItemSize.Value.ToMB()} } | sort TotalItemSizeMB -Descending

Worked perfectly.  
Thank you for your help!
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
It remains to be strange, as there should be no difference ...
1
 
LVL 1

Expert Comment

by:LinuxDude
Comment Utility
get-mailboxstatistics -database "database name" | select DisplayName, ItemCount, TotalItemSize | Sort-Object TotalItemSize -Descending
0

Featured Post

Wish Marketing would stop bothering you?

Is your marketing department constantly asking for new email signature updates? Are they requesting a different design for every department? Do they need yet another banner added? Don’t let it get you down! There is an easy way to manage all of these requests...

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now