Home > Exchange 2010, Scripting > Exchange 2010 MASS Migration Move Queue Status–In an Email

Exchange 2010 MASS Migration Move Queue Status–In an Email

While migrating mailboxes from Exchange 2003 to Exchange 2010, I wanted to get periodic email updates on the mailbox move status.  Below is a quick Exchange PowerShell script to do this work.   (I am sure it can be improved greatly, but it served as a quick fix to my need)

The script: Save this file as Get-MOVE-STATUS.ps1 in your C:\Scripts folder.  (CAS server works best)

$Datevar = (get-date).tostring(“h:mm tt on M-dd-yy “)

$a = “<style>”
$a = $a + “BODY{background-color:white;}”
$a = $a + “BODY{font-size: 9pt; font-family: arial;font-color:#041F92}”
$a = $a + “TABLE{border-width: 0px;border-style: solid;border-color: black;border-collapse: collapse;}”
$a = $a + “TH{border-width: 0px;padding: 1px;border-style: solid;border-color: black;Font-color: white;background-color: Black;}”
$a = $a + “TD{border-width: 0px;padding: 1px;border-style: solid;border-color: black;background-color: DarkKhaki}”
$a = $a + “</style>”

$b = “<H4><b><u>VLAB Mailbox Migration Status</u></b></H4>”

$c = “<H4><b><u>VLAB Mailbox Mailboxes In Progress</u></b></H4>”

$d = “<H4><b><u>VLAB Mailbox Completing Mailboxes (Not quite complete – Waiting on AD Replication)</u></b></H4>”

$GetMoveQueue = Get-MoveRequest –resultsize unlimited | group status | select Name, Count | ConvertTo-Html -Head $a -Body $b
$GetMoveQueueInProgress = Get-MoveRequest -MoveStatus InProgress | Get-moverequeststatistics |select DisplayName,PercentComplete,TotalMailboxSize | ConvertTo-Html -Head $a -Body $c
$GetMoveQueueCompleting = Get-MoveRequest -MoveStatus CompletionInProgress | Get-moverequeststatistics |select DisplayName,PercentComplete,TotalMailboxSize | ConvertTo-Html -Head $a -Body $d

Send-MailMessage -To “admin1@vlab.com”, “admin2@vlab.com” -From “MailboxAdmin@vlab.com” `
-Subject “VLAB Mailbox Migration status as of $Datevar” -SmtpServer “smtp.vlab.com” -Body `
($GetMoveQueue, $GetMoveQueueInProgress,$GetMoveQueueCompleting | Out-String) -BodyAsHtml

 

The Output:

image

 

Note: If you want to automate this, save the above PowerShell Script as Get-MOVE-STATUS.ps1 and then create a batch file with the below text.  You can then create a scheduled task calling the batch file with whatever time iterations you need.  (Be sure to run it as “elevated” or highest privileges and as an account that has access to Exchange servers)

cd \
cd c:\scripts
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto;C:\Scripts\Get-MOVE-STATUS.ps1"

 

Best of luck!

Ed McKinzie

Advertisements
Categories: Exchange 2010, Scripting
  1. June 20, 2012 at 11:05 PM

    very handy indeed, thanks for posting

  1. No trackbacks yet.

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: