Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Exchange Powershell script gives dr Watson

$
0
0

Hi,

When running a powershell (scheduled) through a batchfile I get a dr. Watson error:

WARNING: An unexpected error has occurred and a Watson dump is being generated:
 Operation is not valid due to the current state of the object.
Get-ActiveSyncDeviceStatistics : Operation is not valid due to the current
state of the object.
At D:\Scripts\ActiveSyncExport.ps1:34 char:27
+ $Devices = $Mailboxes | %{Get-ActiveSyncDeviceStatistics -Mailbox
$_.Identity} | ...
+                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-ActiveSyncDeviceStatistic
   s], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Excha
   nge.Management.Tasks.GetMobileDeviceStatistics

But when I run this script from the Exchange Management Shell manually it works normally.

I tried this in the script, but that doesn't work either:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://casserver.ourdomain.com/PowerShell/ -Authentication Kerberos
Import-PSSession $Session

The servers are running Exchange 2010 SP3 with rollup 2.

It looks like a sort of buffer overflow error.

Does anybody know a solution?


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>