$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like
I needed to adapt some scripts that create a user with mailbox for Exchange 2010. The existing scripts had a hardcoded database for new mailboxes.
I wanted the mailbox to be created in the smallest database, but how do we determine this?
For Exchange 2010 this is fairly easy using PowerShell:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Add Exchange Snapins if ((Get-PSSnapin | where {$_.Name -match "Exchange.Management"}) -eq $null) { Add-PSSnapin Microsoft.Exchange.Management.* } # Get largest possible size $size = [Microsoft.Exchange.Data.ByteQuantifiedSize]::MaxValue.ToBytes() foreach ($db in Get-MailboxDatabase -Status) { # Write-Host "Database:" $db.Name "Size:" $db.DatabaseSize.ToBytes() $db | select ServerName,Name,DatabaseSize # Is the Database smaller than previous smallest size if ( $db.DatabaseSize.ToBytes() -lt $size ) { # This database is smaller, store size and db $size = $db.DatabaseSize.ToBytes() $ExDB = $db } } Write-Host "`nSmallest Database:" $ExDB | select ServerName,Name,DatabaseSize |
Leave a reply