views:

281

answers:

3

I need to run a Get-Mailbox | Get-MailboxStatistics command across a large number of mailboxes but the majority have never been used as it is a new install. As a result, I have to sit through hundreds of lines of

WARNING: There is no data to return for the specified mailbox '<mailbox DN>' because it has not been logged on to.

It would seem that I need to use a server-side filter of some kind but I haven't been able to find anything appropriate.

What can I do here?

+1  A: 

There is no server side filtering in Get-MailboxStatistics and I can't repro it. Can you try this:

Get-Mailbox | Get-MailboxStatistics -warningAction silentlyContinue

Shay Levy
A: 

This is the standard PS behavior for warnings. You can find Shay's parameter in the help for common_parameters get-help about_common_parameters. Alternately, you can set $WarningPreference = silentlycontinue. There are no statistics to return as the mailboxes have not yet been initialized, hence the warning.

slipsec
A: 

Shay and slipsec,

I have found the -ErrorAction item in about_commonparameters, but not the -WarningAction item. What am I missing.

Nate

Found the info. Thanks anyway.