' MS Exchange 'This Script goes through a SPECIFIED OU (in this case, it's named "MyOU"), takes each object in the OU and REMOVES the Mailbox Quotas set on any mail-enabled object in the OU 'If you want the script to remove the Warning settings, uncomment the last line before the objcont.setinfo 'My Lawyer says for me to include this line: 'I am NOT responsible for any negative effect that my result from your use of this script. For all I know, this script may F-up your whole Domain Infrastructure. 'My Wife says for me to include this line: 'I am NOT responsible. Const ADS_SCOPE_SUBTREE = 2 ADS_PROPERTY_CLEAR = 1 Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCOmmand.ActiveConnection = objConnection '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''Search for Users ''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' objCommand.CommandText = _ "Select distinguishedName from 'LDAP://myDC.MyDomain.com/OU=myOU,DC=myDomain,DC=com' " _ & "where objectClass='Person' AND objectcategory='User'" objCommand.Properties("Page Size") = 1000 objCommand.Properties("Timeout") = 30 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE objCommand.Properties("Cache Results") = False Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF objUserDN = objRecordSet.Fields("distinguishedName").Value Call ClearQuotas(objUserDN) objRecordset.MoveNext Loop Set objCOmmand.ActiveConnection = Nothing Set objCommand = Nothing Set objRecordSet = Nothing Set objConnection = Nothing ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''' Delete Mailbox Quotas Settings '''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub ClearQuotas(objUserDN) Set objCont = GetObject("LDAP://myDC.MyDomain.com/" & objUserDN) objCont.PutEx ADS_PROPERTY_CLEAR, "mDBOverQuotaLimit", 0 objCont.PutEx ADS_PROPERTY_CLEAR, "mDBOverHardQuotaLimit", 0 'Uncomment the next line if you also don't want to send warning message 'objCont.PutEx ADS_PROPERTY_CLEAR, "mDBStorageQuota", 0 'Uncomment the next line if you want the accounts to use the Default Store Limits 'objCont.mDBUseDefaults = TRUE 'We are now REALLY going to do it objCont.SetInfo 'Clean up Set objCont = Nothing End Sub ''''''''''''''''''''''''''''''''''' '''''''''' The End '''''''''''''''' '''''''''''''''''''''''''''''''''''