Powershel for Auto Mailbox Distribution
here is my thinking... we got 5 student exch2010 db's and 5 staff db's - and we'll be using FIM to create mailboxes in Ex2010. so when we provision new students, what about first excluding the staff db's from the automatic mailbox distribution, create the mbx's, then enable the automatic mailbox distribution for all the db's again. and vica versa when provisioning staff. this might be more efficient then gathering statistics of mbx usage before provisioning a new mailbox. comments?
March 23rd, 2012 1:29am

here is my thinking... we got 5 student exch2010 db's and 5 staff db's - and we'll be using FIM to create mailboxes in Ex2010. so when we provision new students, what about first excluding the staff db's from the automatic mailbox distribution, create the mbx's, then enable the automatic mailbox distribution for all the db's again. and vica versa when provisioning staff. this might be more efficient then gathering statistics of mbx usage before provisioning a new mailbox. comments?
Free Windows Admin Tool Kit Click here and download it now
March 23rd, 2012 1:29am

If no more question on this thread, we may mark it as answered. Thanks. Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com Fiona Liao TechNet Community Support
March 29th, 2012 1:52am

Using RBAC permissions you can change it so only certain DBs are returned\used when creating a MB. If you don't specify the DB name when creating the mailbox Exchange will choose the database with the lowest mailbox count in the current AD site. What you will probably need is a script that will only return certain database and furthermore check the size of the data in those databases and then return the smallest. I just finished up a script to do this and posted it to my blog here: http://info.izzy.org/Blog/archive/2012/03/25/Script_Smallest_DB.aspx Here it is also: # This script will return the smallest mailbox database, which can be useful when creating new mailboxes or re-distributing based on size # Created by Jason Sherry (izzy@izzy.org) 3/25/2012 # Last Updated: 3/25/2012 # Source: http://izzy.org/scripts/Exchange/Admin/Get-SmallestDB.ps1 # Partial code source: http://powershell.com/cs/media/p/3981.aspx $MBXDbs = Get-MailboxDatabase | Where-Object {$_.Identity -like "Users-US-*"} # This will exclude any DB that started with "TCN-EU-" # Loop through each of the MBXDbs ForEach ($MBXDB in $MBXDbs) { # Get current mailboxes sizes by summing the size of all mailboxes and "Deleted Items" in the database $TotalItemSize = Get-MailboxStatistics -Database $MBXDB | %{$_.TotalItemSize.Value.ToMB()} | Measure-Object -sum $TotalDeletedItemSize = Get-MailboxStatistics -Database $MBXDB| %{$_.TotalDeletedItemSize.Value.ToMB()} | Measure-Object -sum #Get-MailboxDatabase and the DatabaseSize property was not used since it does not return a value in some environments as of 2010 SP2 $TotalDBSize = $TotalItemSize.Sum + $TotalDeletedItemSize.Sum # Compare the sizes to find the smallest DB If (($TotalDBSize -lt $SmallestDBsize) -or ($SmallestDBsize -eq $null)) { $SmallestDBsize = $DBsize $SmallestDB = $MBXDB } } Write-host "Smallest DB: " $SmallestDB At the end you could then do a New-Mailbox command Microsoft Infrastructure Architect, MCSE: M, MCTIP, Microsoft Exchange MVP http://info.izzy.org | http://jasonsherry.org | Twitter: @JasonSherry
Free Windows Admin Tool Kit Click here and download it now
April 28th, 2012 6:51pm

thank you Fiona, the script works on the exchange server - however, when I run this from a remote computer I get a few error messages: Cannot process argument transformation on parameter 'Database'. Cannot convert the "Mailbox Database 003" value of type "Deserialized.Microsoft.Ex change.Data.Directory.SystemConfiguration.MailboxDatabase" to type "Microsoft.Exchange.Configuration.Tasks.DatabaseIdParameter". + CategoryInfo : InvalidData: (:) [Get-MailboxStatistics], ParameterBindin...mationException + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-MailboxStatistics PS. I have imported the exchange PSSession cmdlets unto the remote server.
April 28th, 2012 8:15pm

Hi, When using the Ex2010 automatic mailbox distribution concept, what is the minimum 'new-mailbox' cmdlet switches that we should use to create a new mailbox, and let Exchange auto-place it? Also, can I tell powershell to only look at 5 specific databases (and ignore the remaining 4 databases) when doing the Auto Mailbox distribution? thanks sk
Free Windows Admin Tool Kit Click here and download it now
April 28th, 2012 10:39pm

here is my thinking... we got 5 student exch2010 db's and 5 staff db's - and we'll be using FIM to create mailboxes in Ex2010. so when we provision new students, what about first excluding the staff db's from the automatic mailbox distribution, create the mbx's, then enable the automatic mailbox distribution for all the db's again. and vica versa when provisioning staff. this might be more efficient then gathering statistics of mbx usage before provisioning a new mailbox. comments?
April 29th, 2012 1:37am

If no more question on this thread, we may mark it as answered. Thanks. Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com Fiona Liao TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
April 29th, 2012 1:59am

Note that you need to use different user accounts to create mailbox for student's DB and for Staffs' DB. Say the user account used to create mailbox in Student's DB can only see student's DB. And the user account used to created mailbox in Staff's DB can only see Staff's DB. Refer to: http://technet.microsoft.com/en-us/library/ff628332.aspx http://technet.microsoft.com/en-us/library/ff477621.aspxFiona Liao TechNet Community Support
April 29th, 2012 4:50am

Try replace Get-MailboxStatistics -Database $MBXDB to Get-MailboxStatistics -Database $MBXDB.DistinguishedName
Free Windows Admin Tool Kit Click here and download it now
June 16th, 2012 12:41pm

Try replace Get-MailboxStatistics -Database $MBXDB to Get-MailboxStatistics -Database $MBXDB.DistinguishedName
June 16th, 2012 12:41pm

Try replace Get-MailboxStatistics -Database $MBXDB to Get-MailboxStatistics -Database $MBXDB.DistinguishedName
Free Windows Admin Tool Kit Click here and download it now
June 16th, 2012 12:43pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics