This script is intended for reporting purposes.
It enumerates all individual mailbox limits in Active Directory/Exchange.
Follow the next steps to run the script (no admin rights needed):
- open your favorite text editor
- copy and paste the script into the editor
- save the script (for example c:tempmailboxlimits.vbs)
- open a command prompt
- go to “c:temp”
- give “cscript mailboxlimits.vbs” (without quotes) and enter
The script:
' Name : mailboxlimits.vbs
' Description : script to enumerate all individual mailbox limits in Active Directory/Exchange
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 27-01-2010
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(mDBUseDefaults=FALSE)"
strAttributes = "displayname, mail, mDBStorageQuota, mDBOverQuotaLimit, mDBOverHardQuotaLimit, mDBUseDefaults"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
Set objRecordset = adoCommand.Execute
Wscript.echo "displayname" & " ; " & "smtp address" & " ; " & "warning limit" &_
" ; " & "send limit" & " ; " & "send en receive limit"
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("displayname").Value & " ; " &_
objRecordSet.Fields("mail").Value & " ; " &_
objRecordSet.Fields("mDBStorageQuota").Value/1024 & " MB " &_
objRecordSet.Fields("mDBOverQuotaLimit").Value/1024 & " MB " &_
objRecordSet.Fields("mDBOverHardQuotaLimit").Value/1024 & " MB "
objRecordSet.MoveNext
Loop
Set objRecordset = Nothing
Set objRootDSE = Nothing
Set adoConnection = Nothing
Set adoCommand = Nothing
