Powershell – How to filter Exchange 2013 new-moverequest by “StatusDetail”

email-serverexchange-2013powershell

I am trying to make a report of "interesting" moves, errored, lagged, or slow.

I'm starting with this

Get-MoveRequest -ResultSize unlimited 
   | where {$_.status -ne "Completed" 
    -and ( ( $_.StatusDetail -ne "CopyingMessages") 
      -and ( $_.StatusDetail -ne "Queued") ) } 
   | Get-MoveRequestStatistics |sort percentcomplete 
   | ft displayname, percentcomplete,  status, statusdetail, syncstage, baditemsencountered, totalinprogressduration, totalmailboxsize, message, validationmessage, *duration -a

However there is no impact to the output. I've experimented with the parenthesis but to no avail

Best Answer

Try This:

Get-MoveRequest -ResultSize unlimited | 
Where {$_.status -ne "Completed" -and $_.StatusDetail -ne "CopyingMessages" -and $_.StatusDetail -ne "Queued" } | 
Get-MoveRequestStatistics | 
Format-Table Displayname, Percentcomplete, Status, Statusdetail, Syncstage, Baditemsencountered, Totalmailboxsize, Message, Validationmessage, *duration -AutoSize