Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

Finding DL's containing a specific domain

Hi

Our environment is Exchange 2007 SP3, but we have migrated our IT and other selected users to Exchange 2010 which we are rolling out. Our domain is exchange.com

We have several hundred Exchange distribution lists. Some of these contain external recipients (partner companies etc).

We have a partner company, domain.com, that we sometimes do business with. Some of their contacts are members of our DL's. Management have decided that they no longer want ANY domain.com addresses as members of our DL's.

Does anyone know a Powershell command I can run that will search ALL DL's and provide a list where this is any domain.com recipient in them?

And do we need to run this on an Exchange 2007 or Exchange 2010 machine, or does it not matter?
0
wyclef1
Asked:
wyclef1
  • 3
  • 2
  • 2
  • +2
1 Solution
 
Em ManCommented:
hmmm...Let me know if this will work.

Go to AD

Customer Search > Advance Tab

Enter LDAP Query:
(proxyAddresses=smtp:*@domain.com)
0
 
Em ManCommented:
sorry, I know you are looking for PS.
0
 
AkhaterCommented:
this should do it for you
$grps = Get-DistributionGroup -ResultSize unlimited

foreach ($grp in $grps){
	$mbrs = Get-DistributionGroupMember $grp
	foreach ($mbr in $mbrs){
		if ($mbr.RecipientType -eq "UserMailbox") {
			$mbmails = (get-mailbox $mbr.DistinguishedName).EmailAddresses
		} elseif ($mbr.RecipientType -eq "MailContact") {
			$mbmails = (get-mailcontact $mbr.DistinguishedName).EmailAddresses
		}
		if ($mbmails -like "*@domain.com") {
			write-host $grp $mbr.name
		}
	}
}

Open in new window

0
Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

 
Shabarinath RamadasanInfrastructure ArchitectCommented:
Try this using power-shell.

Get-QADObject -ProxyAddress "*.exchange.com*" -searchroot "DC=Domainname, DC=COM" |select name, type

Make sure you have quest active roles for power shell is installed.

http://www.quest.com/powershell/activeroles-server.aspx

Good luck
Shaba
0
 
Azeem PatelSystem AdministartorCommented:
Go ADUC > Find > Select users and Contacts from options > Search query *@domain.com

0
 
wyclef1Author Commented:
Thanks All

Yes, we have Quest Powershell.

Is it possible to use Shaba's query to pull specific DL's that have @domain.com as members? I think the below will just give me a list of ALL objects with that address?

Get-QADObject -ProxyAddress "*.exchange.com*" -searchroot "DC=Domainname, DC=COM" |select name, type



0
 
AkhaterCommented:
did u try my script?
0
 
AkhaterCommented:
I am sorry did you try my script ? it will give you exactly what you asked for the list of all groups with any memeber @domain.com
0
 
Shabarinath RamadasanInfrastructure ArchitectCommented:
Sorry, my mistake.
Instead of Get-qadobject, you can use get-qadgroup

Good luck
Shaba
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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