切换到宽版
  • 5041阅读
  • 0回复

[求助]使用脚本从Exchange 2003到Exchange 2007迁移邮箱 [复制链接]

上一主题 下一主题
 
只看楼主 倒序阅读 0楼  发表于: 2011-03-19
— 本帖被 YOYO 从 Exchange 脚本中心 移动到本区(2015-06-25) —
  • 脚本环境:PowerShell
  • 适合版本:Exchange 2007
  • 适用平台:
使用此脚本可以通过读取文本文件中的用户别名将邮箱从Exchange 2003迁移到Exchange 2007。

# 1. Login into destination Exchange 2007 Server
# 2. Set the database name in line $TargetDatabase = "Mailbox Database" where you want to move the mailboxes
# 3. Put the list of all user's alias into c:\users.txt file
# 4. Copy this file at C:\Program Files\Microsoft\Exchange Server\scripts with name Move-Mailboxes.ps1
# 5. Run the cmdlet from Exchange Power Shell
# 6. Once all mailboxes moves check the file c:\MoveLog.txt file for any error during movement
$TargetDatabase = "Mailbox Database"
$SourceFile = "c:\users.txt"
$a = remove-item c:\Movelog.txt -ea SilentlyContinue
$error.Clear()
$UserList = Get-Content $SourceFile
foreach($user in $UserList)
{
     $message = "Moving User -> " + $user
     write-output $message | out-file -filePath "c:\MoveLog.txt" -append -noClobber
     move-mailbox -Identity $user -TargetDatabase $TargetDatabase -BadItemLimit 5 -Confirm: $false
     if($error.Count -ne 0)
     {
           $message = "User " + $user + " failed to move ???????????"
           write-output $message | out-file -filePath "c:\MoveLog.txt" -append -noClobber
           $message = "Error:::: " + $error[0].ToString()
           write-output $message | out-file -filePath "c:\MoveLog.txt" -append -noClobber
           $error.Clear()
     }
}

分享到
快速回复
限60 字节
 
上一个 下一个