Solved

Exchange 2013 Powershell Command Help

Posted on 2016-09-19
11
103 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +3
11 Comments
 
LVL 19

Expert Comment

by:suriyaehnop
ID: 41804947
Try use this powershell from microsoft gallery

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

Expert Comment

by:-MAS
ID: 41804951
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
ID: 41804991
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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 49

Assisted Solution

by:Akhater
Akhater earned 150 total points
ID: 41805021
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 70

Accepted Solution

by:
Qlemo earned 350 total points
ID: 41805105
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
 

Author Comment

by:zito2000
ID: 41805195
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 70

Expert Comment

by:Qlemo
ID: 41805208
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
ID: 41805217
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
ID: 41805219
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 70

Expert Comment

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

Expert Comment

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
In this video we show how to create an Accepted Domain 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 Mail Flow >> Ac…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

724 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