January 1, 2012 at 12:00 am #6516MemberPoints: 0Rank: Member
by jstumbo at 2013-02-13 13:22:08
We have several scripts that are running against Exchange 2010. The server was updated to Exchange SP2 Rollup 5v2 over the weekend and all the scripts are failing. The workstation where the scripts were run was also updated to Rollup 5v2.
When I try this:
get-mailbox email@example.com | Get-MailboxfolderStatistics
It returns this:
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-MailboxFolderStatistics : Operation is not valid due to the current state of the object.
At line:1 char:63
+ get-mailbox firstname.lastname@example.org | Get-MailboxfolderStatistics < <<<
+ CategoryInfo : NotSpecified: (:) [Get-MailboxFolderStatistics], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Exchange.Management.Tasks.GetMailboxFolderSta
Yet if I use get-mailboxstatistics nstead of get-mailboxfolderstatisticss it works:
get-mailbox email@example.com | Get-MailboxStatistics
DisplayName ItemCount StorageLimitStatus LastLogonTime
----------- --------- ------------------ -------------
Smith, Jim 21761 NoChecking 2/13/2013 1:18:35 PM
Anyone know why get-mailboxfolderstatistics would fail but get-mailboxstatistics would work? Also, when this is run from the CAS server, it works just fine.
by DonJ at 2013-02-13 13:35:32
There are/were some known issues using PowerShell v3 with Exchange 2010. I don't know all the specifics, but see if that might be the problem. Otherwise, I think this might be something you should take up with Product Support. There's a lot of moving bits and bobs in there.
The error message is suggesting that the result of Get-Mailbox isn't what the next command is expecting... which obviously should not be the case. The fact that the command works interactively makes me want to ask HOW you're running the script. You get this error when running the script interactively in the console, or is it scheduled, or is it being run from some other UI? Does the script have any #requires or #version tags near the top? Is the script maybe loading an outdated version of the Exchange commands?
by jstumbo at 2013-02-13 14:36:57
It does not work interactively. The second one is Get-mailboxstatistics, without the "folder" in the middle. Both however work fine when run from the Exchange Management Shell on the Exchange server. Just not when I run them from a server that we have all our scripts running on. It was updated with the same update for exchange.
by pyro3113 at 2013-02-15 23:38:02
I think the first thing I would do in this situation would be to pipe the get-mailbox firstname.lastname@example.org to get-member on both your exchange server and the machine that you're running your scripts on and ensure that you're getting the same object output in both instances.
The topic ‘Error calling Get-MailboxFolderStatistics’ is closed to new replies.