Link to home
Start Free TrialLog in
Avatar of bgcpc
bgcpc

asked on

Export Members of all Query Based Distribution Groups

Our environment:
Active Directory 2003
Exchange 2003

I am needing to export a list of all QBDG and their members. I have been looking all over and haven't found a good way to do this.

It seems to be much easier if we were running Exchange 2007 or higher.

Any suggestions? Command line tools, powershell, etc.?
Avatar of SubSun
SubSun
Flag of India image

Try with csvde, Refer the link for details..
http://apps.fmc.com/Blog.nsf/dx/query-based-distribution-groups.htm
Another option is is using ADUC custom query,
Active Directory Users and computers > Right-Click the folder Saved Queries and select New query > Give a name >Click Define Query > From the drop down list select Custom Search> Click Advanced tab > Create a custom query by copy pasting the LDAP filter from QBDG to query the users..User generated imageRight-click on your query and use Export List to save the result to .csv file..
Avatar of bgcpc
bgcpc

ASKER

Thanks for the info everyone. These are good suggestions for getting the members of one group.
We have hundreds and I was hoping for a scripted solution to pull all query based groups and members and dump them to a csv.

I found similiar solutions for regular groups, but not query based.
If you have Quest PowerShell for Active Directory then try the following script..I have not tested the code, but I think it should work..
$Groups = Get-QADObject -LdapFilter '(objectClass=msExchDynamicDistributionList)' -IncludedProperties msExchDynamicDLFilter -SizeLimit 0
   Foreach ($Group in $Groups){
	$Users = Get-QADObject -LdapFilter '$($Group.msExchDynamicDLFilter)' -SizeLimit 0
	    Foreach ($User in $Users){
		New-object PSObject -Property @{Group=$Group.Name;Member=$User.Name}
	   }
	}

Open in new window

Avatar of bgcpc

ASKER

It looks like the script is looping through and finding the groups, but outputs the following error.

Get-QADObject : Invalid filter format: '$($Group.msExchDynamicDLFilter)'
At C:\apps\powershell\questgetdlgroups.ps1:3 char:24
+     $Users = Get-QADObject <<<<  -LdapFilter '$($Group.msExchDynamicDLFilter)' -SizeLimit 0
    + CategoryInfo          : NotSpecified: (:) [Get-QADObject], LdapFilterException
    + FullyQualifiedErrorId : Quest.ActiveRoles.ArsPowerShellSnapIn.BusinessLogic.LdapFilterException,Quest.ActiveRole
   s.ArsPowerShellSnapIn.Powershell.Cmdlets.GetGenericObjectCmdlet
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bgcpc

ASKER

This is exactly what I needed. IT did run for about 6 hours. It might be helpful to be able to specify an OU to cut down on the run time.
But, it got me what I needed. Thanks.
You can do that by adding a SearchRoot
$Groups = Get-QADObject -SearchRoot 'company.com/TestOU' -LdapFilter '(objectClass=msExchDynamicDistributionList)' -IncludedProperties msExchDynamicDLFilter -SizeLimit 0

Open in new window

Avatar of bgcpc

ASKER

OK, cool.
Thanks.