Solved

Get-MailboxStatistics and Get-Mailbox

Posted on 2014-09-22
4
517 Views
Last Modified: 2014-09-24
Hi there,

Hope you can help :)

I have a powershell script that runs daily to capture any mailboxes on Exchange 2007 that have the UseDatabaseQuotaDefaults field unticked in their mailbox properties. Command is below and works fine

Get-Mailbox -Server "Mail01" -ResultSize unlimited |Where{($_.UseDatabaseQuotaDefaults -eq $false)} | Sort-Object Name | Select-Object name,Database,ProhibitSendQuota,@{n="Actual Mailbox Size(MB)";e = {$MBXstat = Get-MailboxStatistics $_.name; $MBXstat.totalItemsize.value.toMB()}

What i'd like to run is only show mailboxes that are below 500MB AND have the UseDatabaseQuotaDefaults box unticked ($false).

Thanks so much for your help
0
Comment
Question by:Terellion
  • 2
4 Comments
 
LVL 28

Assisted Solution

by:becraig
becraig earned 250 total points
ID: 40337175
Something like this should work for you:

Get-Mailbox -Server "Mail01" -ResultSize unlimited  |  Where{($_.UseDatabaseQuotaDefaults -eq $false)} | Get-MailboxStatistics Where {$_.totalItemsize.value.toMB() -lt 500MB}

Open in new window

0
 
LVL 16

Accepted Solution

by:
Rajitha Chimmani earned 250 total points
ID: 40337814
Correction in the above line of code. The method tomb() will convert the value to integer. So, you need to compare with an integer to get correct results


Get-Mailbox -Server "Mail01" -ResultSize unlimited  |  Where{($_.UseDatabaseQuotaDefaults -eq $false)} | Get-MailboxStatistics | Where {$_.totalItemsize.value.toMB() -lt 500}

Open in new window

0
 
LVL 28

Expert Comment

by:becraig
ID: 40337841
Yup  I missed removing the MB since it would be an integer comparison thanks :~)
0
 

Author Comment

by:Terellion
ID: 40340981
Absolutely awesome thanks so much!!! :)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
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…
To show how to create a transport rule 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 >> Rules tab.:  To cr…

757 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

16 Experts available now in Live!

Get 1:1 Help Now