Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I suppress warnings from Exchange 2010's PowerShell Get-MailboxStatistics cmdlet?

I've tried both of these options:

Get-MailboxStatistics -WarningAction SilentlyContinue
Get-MailboxStatistics -ErrorAction SilentlyContinue

However I still get this warning output to the console about users that's haven't logged onto their mailboxes:

WARNING: The user hasn't logged on to mailbox ...[snipped]..., so there is no data to return. After the user logs on, this warning will no longer appear.

share|improve this question
I also tried $WarningActionPreference = "SilentlyContinue" --This will set all warning messages to silent. Looks like something is broken. Looks like there is a bug.… – st3v3o Feb 28 '11 at 17:54
@st3v3o - why not make that an answer and get set up for some bounty? – Kev Feb 28 '11 at 18:04
good call..but I'm not sure I really full answered the question...but worth a shot :P – st3v3o Feb 28 '11 at 18:17
oh I didn't realize you answered the question sorry Kev. – st3v3o Feb 28 '11 at 18:19
up vote 3 down vote accepted

I also tried $WarningActionPreference = "SilentlyContinue" --This will set all warning messages to silent. Looks like something is broken. Looks like there is a bug.

share|improve this answer
+1 You'll probably win this, but I'll leave to run until the end of the bounty before awarding. – Kev Feb 28 '11 at 22:50
FWIW I was doing some additional testing and just running Get-MailboxStatistics -Database <DB NAME> will output all of the users and system boxes that are listed. It will however skip over user accounts that have no statistical data to output (without displaying a warning) – st3v3o Mar 1 '11 at 14:17

I've been playing with this one, trying to recreate the issue (I'm on Exhcange 2007, though, so this may make a difference. I'm also pretty new to powershell). Starting with a new mailbox, "Testy McTest":

>get-variable |where { $_.Name -match "Preference" }

Name                           Value
----                           -----
ConfirmPreference              High
DebugPreference                SilentlyContinue
ErrorActionPreference          Continue
ProgressPreference             Continue
VerbosePreference              SilentlyContinue
WarningPreference              Continue
WhatIfPreference               False

I can run the following:

>Get-MailboxStatistics "Testy McTest"
WARNING: There is no data to return for the specified mailbox 'Testy McTest', because it has not been logged on to.
>Get-MailboxStatistics -WarningAction SilentlyContinue "Testy McTest"   (No Output)
>Set-Variable WarningPreference SilentlyContinue
>Get-MailboxStatistics "Testy McTest"   (No output)

This seems to work as normal. It might be worth mentioning that the variables for Error and Warning actions are actually ErrorActionPreference and WarningPreference. Not sure why they differ like that.

As a workaround for the specific command in the question, you could qualify the output, with something like:

>Get-MailboxStatistics |where { $_.LastLogonTime }

Which seems to list only those mailboxes that have a logon time.

share|improve this answer
Looks like things are slightly different in the Exchange powershell way of doing things between 2007 and 2010 ...I tried your above setting and still get output with the EMS for 2010. – st3v3o Mar 1 '11 at 14:20
@st3v3o - yep same here. – Kev Mar 1 '11 at 15:46

@st3v3o - same here, still not fixed even on Exchange 2010 SP2 (14.02.0247.005). I can't add this as a comment because I don't have enough rep points currently.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.