Dear Helpful People:
I have experienced an error while using Powershell to run the Get-ActiveSyncDeviceStatistics cmdlet according to the following scenario:
$m = Get-CASMailbox | where {$_.identity -match 'John Doe'}
$m successfully returns the desired mailbox object and there are no errors.
Next I use the mailbox identity to obtain the users devices as follows:
$d = Get-ActiveSyncDeviceStatistics -Mailbox:$m.Identity
It is at this point that I get the following error:
"Get-ActiveSyncDeviceStatistics : Operation is not valid due to the current state of the object."
Can someone explain why this error might be occurring? It happens whenever I try to gather devices associated with any mailbox.
If I run the same set of commands on the Exchange Server itself, the error does not occur.
When I run the commands on another server with full access to the Exchange Server, it fails.