RSS

将Exchange一个数据库内的用户分散到2个数据库中

06 Dec

需求:有一个数据库中承载了太多用户,需要将用户分散到2个数据库中

设计:

1、确认用户数量

2、平分用户数

涉及到如何分:大小排序?字母排序?

3、移动邮箱

结果

使用[math]::round 来平分用户数,按大小分为2个数据库

   1: $sourceDB = "Specify your Source Database Here"
   2: $targetDBLarge = "Specify your larger database in which 40% of the largest mailboxes will be moved to"
   3: $targetDBSmall = "Specify your smaller database in which the remaining 60% of the smaller mailboxes will be moved to"
   4: ############################################
   5:  Don't modify below this line
   6: ############################################
   7: $a = Get-MailboxStatistics -Database $(Get-Mailboxdatabase | Where-Object {$_.Name -eq $sourceDB}) | where {$_.ObjectClass -NotMatch '(SystemAttendantMailbox|ExOleDbSystemMailbox)'} | Sort-Object Totalitemsize
   8: $rounded = [math]::round($a.count * .5)
   9: $first = $rounded
  10: $last = $a.count - $first
  11: $a | Select-object -Last $last | Move-Mailbox -TargetDatabase $(Get-Mailboxdatabase | Where-Object {$_.Name -eq $targetDBSmall}) 
  12: $a | Select-object -First $first | Move-Mailbox -TargetDatabase $(Get-Mailboxdatabase | Where-Object {$_.Name -eq $targetDBLarge}) 
Advertisements
 
Leave a comment

Posted by on December 6, 2009 in Exchange Server

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: