Solved

Get all mailboxes, but not from specific database

Posted on 2013-06-25
3
284 Views
Last Modified: 2013-06-30
I have 7 databases on my Exchange 2010 server. Lets call them A, B, C, D, E, F and G.
I need to get all mailboxes from all databases, except database C and F.

I have tried with
Get-Mailbox -ResultSize Unlimited | Where {MailboxDatabase -ne 'C' OR 'F'}

Open in new window

But without any success.

Can anyone help me here?
0
Comment
Question by:Kasper Katzmann
  • 2
3 Comments
 
LVL 23

Expert Comment

by:Stelian Stan
Comment Utility
You can do one database at the time and exported to a txt or csv file:

Get-MailboxDatabase "IT" | Get-Mailbox | Out-File C:\it.txt

Open in new window

Get-MailboxDatabase "IT" | Get-Mailbox | Export-Cvs C:\it.csv

Open in new window

0
 

Accepted Solution

by:
Kasper Katzmann earned 0 total points
Comment Utility
I've found the solution by juggling a little bit around:
Get-Mailbox | `
	Where-Object {`
		($_.Database -ne 'C') -AND `
		($_.Database -ne 'F')}

Open in new window

0
 

Author Closing Comment

by:Kasper Katzmann
Comment Utility
It solves the problem and answers the question
0

Featured Post

Wish Marketing would stop bothering you?

Is your marketing department constantly asking for new email signature updates? Are they requesting a different design for every department? Do they need yet another banner added? Don’t let it get you down! There is an easy way to manage all of these requests...

Join & Write a Comment

Suggested Solutions

Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
In this video we show how to create a Shared Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Sha…
how to add IIS SMTP to handle application/Scanner relays into office 365.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now