Solved

Exchange 2013 Powershell Command Help

Posted on 2016-09-19
11
83 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 25

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 69

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 69

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 69

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This article explains how to install and use the NTBackup utility that comes with Windows Server.
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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