• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 802
  • Last Modified:

Query Excahnge Dynamic Dist list and export to a test

I have Exchange 2010 SP1 and it appears that I need to run this to query a dyn dist list for members

$group = get-DynamicDistributionGroup -identity "AJ.All.Staff"
Get-Recipient -LdapRecipientPreviewFilter $group.RecipientFilter

The 2nd line needs -LdapRecipientPreviewFilter apparently rather than –RecipientPreviewFilter (which works with 2007)

But it will not work.  Please help me
0
stowyo
Asked:
stowyo
  • 2
  • 2
1 Solution
 
AkhaterCommented:
$group = get-DynamicDistributionGroup -identity "AJ.All.Staff"
Get-Recipient -RecipientPreviewFilter $group.RecipientFilter

works just fine as it is
0
 
AkhaterCommented:
for a more accurate result you should use

Get-Recipient -RecipientPreviewFilter $group.RecipientFilter -OrganizationalUnit $Group.RecipientContainer
0
 
stowyoAuthor Commented:
I tried this and it did not work...
Get-Recipient -RecipientPreviewFilter $group.RecipientFilter -OrganizationalUnit "ou=BA, ou=Europe, dc=mycompany, dc=com" $Group.RecipientContainer

I cannot figure out the way to put in the OU.  

Also, will this show the hidden mailboxes?  I do not want to show those..
0
 
stowyoAuthor Commented:
Sorry, I just figured it out.  The OU had an incorrect domain name which threw me off for a while, but I found out that I do not need to specify an OU.  Here is the complete command for future geeks looking to figure out how to do this...

$group = get-DynamicDistributionGroup -identity "AJ.All.Staff"

Get-Recipient -RecipientPreviewFilter $group.RecipientFilter -OrganizationalUnit $Group.RecipientContainer

Those above commands should be on two lines.  The second line may wrap on your screen here at experts-exchange but needs to be entered as one command...
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now