0-2
0-2

Reputation:

How can I filter mailboxes that have never been logged on in Exchange Management Shell?

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?

Upvotes: 1

Views: 2301

Answers (2)

slipsec
slipsec

Reputation: 3062

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.

Upvotes: 0

Shay Levy
Shay Levy

Reputation: 126722

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

Upvotes: 1

Related Questions