Recipe 5.5. Controlling Mailbox Size LimitsProblemYou want to apply mailbox size limits to users, groups, or organizational units, but Exchange only lets you set them on servers, mailbox databases, or the Exchange organization. SolutionUsing a graphical user interfaceTo set mailbox limits on an individual user, do the following:
Using a command-line interfaceTo set a user's quota limits from the command line, use exchmbx with the -quota switch: exchmbx -b <userDN> -quota <warningLimit>:<prohibitSendLimit>:<prohibitReceiveLimit> You specify the quota limits in kilobytes, using ordinary integers (e.g., 100000:120000:125000 to specify limits of 100 MB, 120 MB, and 125 MB, respectively). To get mailbox send and receive limits for multiple users, you can use the csvde command to generate a CSV file listing the specified attribute values for all users. Here's an example: > csvde -f <fileName> -r <searchFilter> -l "DN, objectClass, name, mDBSTorageQuota,mDBOverQuotaLimit,mDBOverHardQuotaLimit" <fileName> is the name of the output CSV file; <searchFilter> is the search you want to use ("(&(objectClass=User)(objectCategory=Person))" will grab all mailboxes). Using VBScript' This code gets and sets mailbox quotas on the specified user ' ------ SCRIPT CONFIGURATION ------ strServerName = "<ServerName>" ' e.g., CONT-EXBE01 strContainer= ", <container>, <ForestRootDN>" ' e.g., ", CN=users,dc=robichaux,dc=net" strUser= "<UserName>" ' e.g., "Paul Robichaux" ' ------ END CONFIGURATION --------- ' get the target mailbox Set objMailbox = GetObject("LDAP://" & strServerName & "/CN=" & _ strUser & strContainer) ' get the warning limits; these gets will fail if ' the corresponding limit is not defined on error resume next warnLimit = objMailbox.Get ("mDBStorageQuota") prohibitSendLimit = objMailbox.Get ("mDBOverQuotaLimit") prohibitSendReceiveLimit = objMailbox.Get ("mDBOverHardQuotaLimit") ' display the limits, then bump each of them by 10 KB Wscript.echo "Existing quotas for " & strUser Wscript.echo " warning limit: " & warnLimit Wscript.echo " prohibit send limit: " & prohibitSendLimit Wscript.echo " prohibit send/receive: " & prohibitSendReceiveLimit objMailbox.Put "mDBStorageQuota", warnLimit+10 objMailbox.Put "mDBOverQuotaLimit", prohibitSendLimit+10 objMailbox.Put "mDBOverHardQuotaLimit", prohibitSendReceiveLimit+10 objMailbox.SetInfo WScript.Echo "Quotas for " & strUser & " updated." DiscussionYou can set mailbox storage limits in several different places, depending on how widely you want them to apply. By default, the storage limits you put on a mailbox (or public folder) database applies to the objects it contains; however, you can override those limits for individual mailboxes. As an optimization, only those limits that are actually set are stored. For example, let's say you've configured a database to provide a default set of limits of 200 MB for warning, 300 MB for prohibit send, and 325 MB for prohibit send/receive. You then edit a handful of mailboxes to apply new limits, unchecking Use mailbox store defaults and filling in your own values for the warning limit. If you then try to query the value of mDBOverQuotaLimit and mDBOverHardQuotaLimit on the mailbox, you'll find that these attributes don't exist; instead, you'll have to check the limits on the mailbox store to find out what the default limits are. See AlsoRecipe 4.5 for applying system policies to servers and Recipe 4.10 for setting default send/receive size limits on messages in transit |