# encoding: ascii
# api: powershell
# title: Mailbox Move monitor
# description: Run the following from the Exchange 2010 shell and it will give you a semi-graphical view on the status of any open move requests:
# version: 0.1
# author: themoblin
# license: CC0
# x-poshcode-id: 5535
# x-archived: 2014-12-27T21:39:24
# x-published: 2014-10-24T10:52:00
#
#
while ($TRUE) {
	$Requests = get-moverequest|get-moverequeststatistics
	$Requests | Foreach-Object {
		if ($_.status -eq "InProgress") {
			Write-Host -foregroundcolor "Yellow" "Mailbox move for $($_.Displayname) is in progress and is $($_.PercentComplete)% complete"
		}
		elseif ($_.status -eq "Completed"){
			Write-Host -ForegroundColor "Green" "Mailbox move for $($_.Displayname) is complete. $($_.BaditemsEncountered) bad items were encountered"
		}
		elseif ($_.status -eq "Queued"){
			Write-Host -ForegroundColor "RED" "Mailbox move for $($_.Displayname) is still queued"
		}

	}
	Start-sleep -seconds 10
	Clear-Host
}
