How can I filter a Dynamic Distribution Group by Database name?
I need to create a dynamic DL to list the members of an individual database and I'm unable to get the powershell command to filter the results properly.
[PS] C:\>New-DynamicDistributionGroup -Name "test1233"
-RecipientFilter {Database -eq "CN=JournalRecover,CN=Databases,
CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,
CN=Company,CN=MicrosoftExchange,CN=Services,CN=Configuration,DC=company,DC=com" }
The reason I'm attempting this DG is so that I can populate the following powershell script to export email for all users in a database
[PS] C:\>$mbxs = Get-MailboxDatabase rdb16 | Get-MailboxStatistics
[PS] C:\>New-MailboxSearch -Name "test2" -SourceMailboxes $mbxs
-TargetMailbox journalrecover -StartDate "11/1/2012"
-EndDate "11/15/2012" -IncludeUnsearchableItems:$true
-SearchDumpster:$true -ExcludeDuplicateMessages:$true
-DoNotIncludeArchive:$true
Question
- How can I create a DG that filters by Database?
- OR how can I alter the mailbox search so it applies to multiple mailboxes in the database?
Your syntax is correct but you have a typo in your DN. CN=MicrosoftExchange
should be CN=Microsoft Exchange
. You can also preview membership with:
$dyn = Get-DynamicDistributionGroup test1233 Get-Recipient -RecipientPreviewFilter $dyn.RecipientFilter