February 10 2009

Set Exchange 2007 mailbox limits via group membership

Powershell and Exchange 2007 allow for setting user mailbox limits (including warning and send / receive restrictions) based on Active Directory Group Membership.

For example, you can create a Powershell script that sets a 1GB mailbox limit for all users in the ‘Exchange Mailbox 1GB Storage Limit’ Active Directory Group.  Schedule this script to automatically run overnight and you no longer need to move users between mailstores or manually set limits in the account properties. Code below:

 


# Warning size = 975MB
# Stop sending email size = 990MB
# Stop sending and receiving email size = 1GB
# Variables below expressed as bytes 

$WarningSize = 1022361600
$StopSend = 1038090240
$StopAll = 1073741824
$Group = get-group "Exchange Mailbox 1GB Storage Limit"

forEach($Username in $Group.Members){Write-Host $Username; set-mailbox $Username -IssueWarningQuota $WarningSize -ProhibitSendQuota $StopSend -ProhibitSendReceiveQuota $StopAll -UseDatabaseQuotaDefaults $false}



----------------------------------------------------------------------------
I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.

----------------------------------------------------------------------------


Tags: , ,

Posted February 10, 2009 by danovich in category "Exchange", "Powershell

Leave a Reply