Mailboxes in a DAG


We have a DAG named DAG1. It is composed of about 10 mailbox servers.

I'd like to run a command to find all the mailboxes on that DAG, but can't seem to get this to work. Does anyone know how to?
Who is Participating?
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
You can work with Multiple ways ..... Get all into a .ps1

Get-Mailbox |Get-MailboxDatabase DB1 -resultsize unlimited >C:\MailboxDB1.csv
Get-Mailbox |Get-MailboxDatabase DB2 -resultsize unlimited >C:\MailboxDB2.csv Get-Mailbox |Get-MailboxDatabase DB3 -resultsize unlimited >C:\MailboxDB3.csv Get-Mailbox |Get-MailboxDatabase DB4 -resultsize unlimited >C:\MailboxDB4.csv
Get-Mailbox |Get-MailboxDatabase DB5 -resultsize unlimited >C:\MailboxDB5.csv
So on .......

Get-Mailbox -Server "ServerName" -resultsize unlimited >C:\MailboxServer1.csv
Get-Mailbox -Server "ServerName" -resultsize unlimited >C:\MailboxServer2.csv
Get-Mailbox -Server "ServerName" -resultsize unlimited >C:\MailboxServer3.csv
Get-Mailbox -Server "ServerName" -resultsize unlimited >C:\MailboxServer4.csv
So on .......

If you want the output with some specific data you can do a FL and the attributes

- Rancy
Get-mailboxdatabase "name of the Database on the concerned DAG" | Get-mailbox
In a DAG if you have databases named as DB1,DB2...DB10 then run below command -

Get-MailboxDatabase DB* |Get-Mailbox -resultsize unlimited

Incase you have exchange installed in different domains make sure to run before running above command

Set-adserversettings -viewentireforest $false
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

You might want to get the data output also to a file

Get-MailboxDatabase DB* |Get-Mailbox -resultsize unlimited | Export-Csv -NoTypeInformation -Path C:\Data.csv
or better use this

Get-MailboxDatabase DB* |Get-Mailbox -resultsize unlimited >C:\Data.csv
Do you have more than one DAG?  Do you have databases that do not belong to the DAG you want to process?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.