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

Exchange 2010 - show users NOT in a distribution list

Is there some way, with PowerShell or otherwise, to get a list of all users who are NOT in a particular distribution list?  I have a distribution list of users who are not allowed to send/receive external email.  I would like a list of all the users/email addresses that are NOT in that list (ie. those that can send/receive external email).  Is there a way to do that in Exchange 2010?

~bruno71
0
bruno71
Asked:
bruno71
1 Solution
 
paritoshjaniCommented:
Hi,

Run this command from AD (Command Prompt). TO pull the exact  attribute of the Distribution group, go to ADUC > right click the distribution group > Properties > Attribute Editor > Distinguished Name > Copy and Paste it ahead of !memberof=cn parameter.

DSQuery * -Filter "(&(objectCategory=user)(!memberOf=CN=xxxxx,OU=xxxx,OU=xxxx,DC=xxx,DC=xx,DC=xx))" -Attr samAccountName -Limit 0
0
 
FDiskWizardCommented:
Or the Powershell way (with Quest free cmdlets).
get-QADUser -SearchRoot 'DC=My,DC=Company,DC=local' -NotMemberOf 'DOMAIN\NoSoup4You'

Or to check for nested members... SLOWER.
get-QADUser -SearchRoot 'DC=My,DC=Company,DC=local' -NotIndirectMemberOf 'DOMAIN\Group'




0
 
bruno71Author Commented:
Thanks paritoshjani.  That worked.  I tweaked it a little to give me the email address and then exported it to a text file.

DSQuery * -Filter "(&(objectCategory=user)(!memberOf=CN=xxxxx,OU=xxxx,OU=xxxx,DC=xxx,DC=xx,DC=xx))" -Attr mail -Limit 0 > c:\textfile.txt

~bruno71
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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