Mailbox Users Storage limit
My morning task today includes the following: get all mailboxes (Exchange 2003) larger than X megs where the associated user mailbox storage limits are overriding the settings of the Mailbox store.
Storage limit information for user accounts is available in Active Directory Users and Computers on the user ‘Exchange General’ tab (click on ‘Storage Limits’ at the bottom). The ‘Storage Limits’ dialog box specifies the mailbox storage limits for warning or prohibiting a mailbox-enabled user from sending or receiving email. You can also use this dialog box to specify the number of days a deleted item is stored in the mailbox store before it is permanently deleted but for my task it is not needed.
So the script goes as follows:
- Use WMI Get all mailboxes larger than 250MB in size.
- Get the associated mailbox user from AD using Quest AD cmdlets.
- Filter those which override the mailbox store policy (the checkbox, (1) in the figure above is not checked). The LDAP attribute name for the checkbox is mDBUseDefaults and the value is FALSE.
- In addition, extend the filtered mailbox objects with storage limit attributes (and values):
- Issue warning at (KB) – Ldap name (2) is mDBStorageQuota.
- Prohibit send at (KB) – Ldap name (3) is mDBOverQuotaLimit.
- Prohibit send and receive at (KB) – Ldap name (4) is mDBOverHardQuotaLimit.
$Server = "ExchangeServer"
$MbxSize= "250MB"
Get-WMIObject Exchange_Mailbox -Namespace root\MicrosoftExchangeV2 -Computer $server -Filter "size>=$($MbxSize/1kb)" | Foreach-Object {
$IncludedProperties = "mDBUseDefaults","mDBStorageQuota","mDBOverQuotaLimit","mDBOverHardQuotaLimit"
$user = Get-QADUser $_.LegacyDN -IncludedProperties $IncludedProperties
if(!$user.mDBUseDefaults)
{
Add-member -InputObject $_ NoteProperty mDBUseDefaults $user.mDBUseDefaults
Add-member -InputObject $_ NoteProperty mDBStorageQuota $user.mDBStorageQuota
Add-member -InputObject $_ NoteProperty mDBOverQuotaLimit $user.mDBOverQuotaLimit
Add-member -InputObject $_ NoteProperty mDBOverHardQuotaLimit $user.mDBOverHardQuotaLimit –PassThru
}
} | Select-Object MailboxDisplayName,Size,mDBUseDefaults,mDBStorageQuota,mDBOverQuotaLimit,mDBOverHardQuotaLimit