Get-MailboxesOverSizeLim by Chris Brown 10 months ago
View followups from romajan | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/2597"></script>download | new post
Emails a report of Exchange 2010 mailboxes over their size limit.
See here for post: http://www.flamingkeys.com/2011/04/exchange-2010-mailboxes-over-size-limit-report/
- # -------------------------------------------------------------------------------
- # Script: Get-MailboxesOverSizeLimit.ps1
- # Author: Chris Brown
- # Date: 04/04/2011 10:41:00
- # Keywords:
- # comments:
- #
- # Versioning
- # 04/04/2011 CJB Initial Script
- #
- # -------------------------------------------------------------------------------
- # ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠
- # ~ ~ ~ Variables ~ ~ ~
- # ~~ Mail Server Details ~~
- $SmtpServer = "mailserver.yourdomain.local"
- $FromAddress = "alerts@yourdomain.com"
- $ToAddress = "HelpDesk@yourdomain.com"
- $Subject = "[Exchange] Mailboxes over size limits"
- #
- #
- # ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠
- if ( (Get-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue) -eq $null) {
- Write-Verbose "Exchange 2010 snapin is not loaded. Loading it now."
- try { Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010; Write-Verbose "Loaded Exchange 2010 snapin" }
- catch { Write-Error "Could not load Exchange 2010 snapins!"; }
- }
- $overLimit = Get-Mailbox | Get-MailboxStatistics -WarningAction SilentlyContinue | Where {"ProhibitSend","MailboxDisabled" -contains $_.StorageLimitStatus}
- if ($overLimit.Count -gt 0) {
- $mailBody = $overLimit | ft DisplayName,TotalItemSize,StorageLimitStatus | Out-String
- Send-MailMessage -Body $mailBody.ToString() -From $FromAddress -SmtpServer $SmtpServer -Subject $Subject -To $toAddress
- } else {
- "No results"
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
PowerShell Code Repository