How to Find Contacts in Active Directory

by Hayden Roberts

In this post, you will learn how to find contacts in Active Directory with PowerShell and the AD Pro Toolkit.

Contacts in Active Directory are typically used to add external users to a company’s global address list (GAL). Contacts can easily be mixed in with user accounts in Active Directory which can make them hard to find. You can use the Get-ADObject cmdlet to find all or specific contacts in Active Directory.

Finding contacts with PowerShell

Example 1: Find all contacts in Active Directory

Get-ADObject -Filter 'objectClass -eq "contact"' -properties * | select displayname, name, mail

In this example, I use the Get-ADObject cmdlet to find all contacts in Active Directory. I also use the select parameter to limit the attributes that are displayed. Contacts in Active Directory have the objectClass of “contact” so using PowerShell you can filter on this object type.

find contacts in active directory with powershell

Example 2: Find all contacts in an organizational unit (OU)

Get-ADObject -Filter 'objectClass -eq "contact"' -searchbase "OU=Contacts,OU=ADPRO Users,DC=ad,DC=adpro,DC=com"

In this example, I get all contacts from a specific OU by use the -searchbase parameter. You will need the distinguishedName of the OU.

find contacts in ou

Example 3: Find contacts with a specific email address

Get-ADObject -Filter 'objectClass -eq "contact" -and mail -like "*gmail.com*"' -properties * | select displayname, mail

In this example, I use a filter to search for all contacts that contain the gmail.com address.

find contacts by email address

In this example, I filter for contacts that contain the word “hill” in the mail attribute. This can be used as a wildcard search to find contacts with a specific word in the email address.

Get-ADObject -Filter 'objectClass -eq "contact" -and mail -like "*hill*"' -properties * | select displayname, mail
find contacts by wildcard search

Example 4: Find contacts with by first name

Get-ADObject -Filter 'objectClass -eq "contact" -and givenname -eq "Kareem"' -properties * | select displayname, mail, givenname

In this example, I find contacts with a specific first name. This is done by filtering on the giveName attribute and using the -eq (equals) operator.

filter contacts by givename

Finding Contacts in Active Directory using AD Pro Toolkit

The AD Pro Toolkit includes over 200 Active Directory Reports. You can easily find all contacts with a couple of mouse clicks. In addition, you can search for contacts, filter and export them out to a file.

  1. Click on “User Reports”
  2. Click on the “All Contacts” report
  3. Click “Run” to generate the report
  4. To export the report, click on the “Export” button
contact report with toolkit

Example report of all contacts using the AD Pro Toolkit.

list contacts in active directory

You can try the AD Pro Toolkit for free by clicking the download button below.

Download 14-Day Free Trial

Conclusion

In this post, I showed you two options on how to find contacts in Active Directory. With the Get-ADObject you can filter on the contact objectclass to list all contacts. In addition, you can add additional filters to find specific contacts. If you don’t want to mess with PowerShell, I showed you how to get all contacts using the AD Pro Toolkit. The toolkit includes hundreds of easy to use AD reports to simplify the manage and of AD.

Leave a Comment