' This script was originally published in the Exchange Cookbook,
' (http://www.exchangebookcook.com). Written by Paul Robichaux,
' Missy Koslosky, and Devin Ganger. Redistributed with permission
' of the publisher, O'Reilly & Associates.
' This code gets and sets mailbox quotas on the specified user
' ------ SCRIPT CONFIGURATION ------
strServerName = "<dc>" ' ' e.g. "CONT-EXBE01"
strUser= "<userName>" ' e.g. "Paul Robichaux"
strContainer = <container>,<forestDN>" ' e.g. ", CN=Users, dc=robichaux, dc=net"
' ------ END CONFIGURATION ---------
' get the target mailbox
what = "LDAP://" & strServerName & "/CN=" & strUser & strContainer
Set objMailbox = GetObject(what)
' get the warning limits; these gets will fail if
' the corresponding limit is not defined
On Error Resume Next
warnLimit = 0
prohibitSendLimit = 0
prohibitSendReceiveLimit = 0
warnLimit = objMailbox.Get ("mDBStorageQuota")
prohibitSendLimit = objMailbox.Get ("mDBOverQuotaLimit")
prohibitSendReceiveLimit = objMailbox.Get ("mDBOverHardQuotaLimit")
' display the limits, then bump each of them by 10Kb
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
|