' Written by: Stacy Spear (Darkstar 3D) ' Date: April 30, 2007 ' This code modifies the mailbox size limits of an entire container or OU. Run the command without arguments to get a help display ' Version History '1.0 - Original 'Argument Check If Wscript.Arguments.Named("ou") = "" or Wscript.Arguments.Named("warn") = "" or Wscript.Arguments.Named("nosend") = "" or Wscript.Arguments.Named("disable") = "" Then 'Check for the named arguments 'Send help message if arguments is not correct Wscript.echo "You must specifiy the target OU and the sizes for Warning, Nosend," Wscript.echo "and Disable using syntax like this:" Wscript.echo Wscript.echo "modmbxperms.vbs /ou:""target ou"" /warn:80000 /nosend:90000 /disable:100000" Wscript.echo "Account running this script MUST have enough AD rights to make these changes" Wscript.Quit End If 'Connect to AD Set RootDSE = GetObject("LDAP://RootDSE") strDomain = RootDSE.Get("DefaultNamingContext") ou = Wscript.Arguments.Named("ou") & "," & strDomain ' Build the LDAP connection string for the OU or container 'Copy arguments to variables for ease of use warn = Wscript.Arguments.Named("warn") nosend = Wscript.Arguments.Named("nosend") disable = Wscript.Arguments.Named("disable") 'Query AD for members of the OU Set objGroup = GetObject("LDAP://" & ou) 'Update AD for each user in the OU For each objUser in objGroup If objUser.class="user" then objUser.mDBUseDefaults = False 'Toggle the switch for "Use Mailbox Store Defaults" to off objUser.Put "mDBStorageQuota", warn ' Warning Limit objUser.Put "mDBOverQuotaLimit", nosend 'Nosend Limit objUser.Put "mDBOverHardQuotaLimit", disable 'Disable Mailbox Limit objUser.SetInfo 'Write object to AD intCounter = intCounter +1 'Increment the counter End if next WScript.Echo intCounter & " Limits Changed " WScript.Quit