MigrationBatch Status Property behaves differently when using imported PS-Session vs Exchange Mgmt Shell

I have discovered that when accessing the MigrationBatch.Status property from an imported PS-Session it is required to use the notation "MigrationBatch.Status.Value".  However when accessing the same property from the Exchange Management Shell I only have to use Migration.Status.  This caused my script developed in the IDE to fail when run directly from the Server.  Here is the example:<o:p></o:p>

Note: I had screenshots but I could not post them.

Imported PS-Session<o:p></o:p>

$BatchStatus = Get-MigrationBatch 'testbatch1'
"$BatchStatus.Status" returns an object, while "$BatchStatus.Status.Value" returns a string.

Exchange Management Shell<o:p></o:p>

$BatchStatus = Get-MigrationBatch 'testbatch1'

"$BatchStatus.status" returns a string, while "$BatchStatus.status.value" returns $null.

I have not found another object that behaves this way yet in my travels.  My workaround is to use the ToString() method since that will return what I need in both environments.  I hope that is a local issue to this object. Just for grins I tried the same on the MigrationType property and it behaved the same way.

Figured I would post this for anyone that was receiving the same issue and if anyone has any insights.

June 10th, 2015 2:17pm

Thanks for sharing this workaround with us.
Free Windows Admin Tool Kit Click here and download it now
June 11th, 2015 5:00am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics