locked
Get-mailbox -ResultSize 1....get rid of warning RRS feed

  • Question

  • Hi Exchange admins,

    I'm doing this: Get-Mailbox -OrganizationalUnit $Company -ResultSize 1 -WarningAction Silentlycontinue......

    And yes I only need 1 mailbox returned. Event though I state -WarningAction SilentlyContinue I still get this warning:

    " WARNING: There are more results available than are currently displayed. To view them, increase the value for the ResultSize parameter. " - I really don't want that warning. Does anybody have a tip on how I can totally avoid this?

    Thank you ;-)


    Red Baron
    Monday, January 30, 2012 11:42 PM

Answers

  • Yes. 

    I just tested on mine, and I can suppress the warning with -warningaction 0 or 'silentlycontinue' in a generice PS session with the snapin loaded.

    In an actual EMS shell, it ignores the -waringaction, and it also appears to ignore $warnpreference.


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
    • Marked as answer by The Red Baron Tuesday, January 31, 2012 12:36 AM
    Tuesday, January 31, 2012 12:27 AM

All replies

  • Are you running Exchange 2010?
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
    Monday, January 30, 2012 11:54 PM
  • Yes I am
    Red Baron
    Monday, January 30, 2012 11:54 PM
  • That seems to be a bug introduced by the remoting environment.   I've also noticed the -WarningVariable parameter doesn't work in that enviroment, either.

    An (unsupported) workaround is to load the management snapin into a generic ps session and do it from there:

    add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010

    NOTE: this is not supported by Microsoft.  I have found a few commands do not work properly, and anything you do it this environment will bypass RBAC roles, and Admin Audit Logging.

     


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
    Tuesday, January 31, 2012 12:01 AM
  • Thank you for the answer mjolinor....I allready tried in a generic ps session. Still get that warning.

    (Just to be sure, we agree that a generic PS session is just a regular powershell window and not the Exchange specific shell window, right?)

     


    Red Baron
    Tuesday, January 31, 2012 12:08 AM
  • Yes. 

    I just tested on mine, and I can suppress the warning with -warningaction 0 or 'silentlycontinue' in a generice PS session with the snapin loaded.

    In an actual EMS shell, it ignores the -waringaction, and it also appears to ignore $warnpreference.


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
    • Marked as answer by The Red Baron Tuesday, January 31, 2012 12:36 AM
    Tuesday, January 31, 2012 12:27 AM
  • I don't know what I did wrong before, just tested again and yes it works. Thank you! Do you have any idea why using a generic ps session for Exch. commands is not supported by ms? I mean it works and all! Ok Exchange has it's own shell but.....is there any caveats?

    Thank you.


    Red Baron
    Tuesday, January 31, 2012 12:36 AM
  • I know that  Enable-UMMailbox does not work.  It appears to run, but says no properties of the object have been changed, and it remains disabled.

    As far as  why they did it that way, it makes the management environment the same for on-premise and hosted.  If you're in a on-premise environment, it's making you pretend there's a cloud betwen your machine and the server in the next room, and everthing has to be serialized, coverted to a SOAP stream then deserialized and converted back into objects at the other end, with all of the attendant loss of fidelity and methods that goes with serialization.  I'm sure it makes for a smooth transition from an on-premise to a hosted environment, but some things just don't work they way you'd expect them to.

    In the EMS, it appears that you're not running the cmdlets any more, you're now running proxy functions.  If you load the snapin in a generic pssession and do a get-command on the exchange cmdlets, the Capability will be Cmdlet.  If you do it in and EMS shell, it says they are Functions.


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
    Tuesday, January 31, 2012 12:50 AM