Error calling Get-MailboxFolderStatistics

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 3 months ago.

  • Author
    Posts
  • #6516

    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 jim@mycompany.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 jim@mycompany.com | Get-MailboxfolderStatistics < <<<
    + CategoryInfo : NotSpecified: (:) [Get-MailboxFolderStatistics], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Exchange.Management.Tasks.GetMailboxFolderSta
    tistics

    Yet if I use get-mailboxstatistics nstead of get-mailboxfolderstatisticss it works:
    get-mailbox jim@mycompany.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.

    TIA
    Jim

    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 jim@mycompany.com 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.

You must be logged in to reply to this topic.