Solved

Exchange 2013 Powershell Command Help

Posted on 2016-09-19
11
59 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
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
 
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 68

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
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

 

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 68

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 68

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
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
In this video we show how to create a Contact 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 Recipients >> Contact ta…
how to add IIS SMTP to handle application/Scanner relays into office 365.

910 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

21 Experts available now in Live!

Get 1:1 Help Now