Active Directory user objects can login to domain, contact objects cannot. Contact objects appear in GAL. Contacts are typically used to represent external users for the purpose of sending e-mails. How to find them in PowerShell?
Sometimes they are scattered across organizational units. To find all of them run a simple PowerShell One-Liner.
Get-ADObject -Filter 'objectClass -eq "contact"' -Properties CN | Format-List CN
Use an additional filter to retrieve only the contact whose name is Peter including all properties.
Get-ADObject -Filter {(objectClass -eq "contact") -and (cn -like "*Peter*")} -Properties *
Categories: PowerShell, Windows Server
I am looking for a script to pull the member-of details for a list of contact cards though PowerShell
LikeLike
thanks, this is what i was looking for.
LikeLike
You’re welcome.
LikeLike
How can I get disabled mail-contact?
LikeLike
If you use pipe followed by the where-object clause, all objects of type contact will be read and then the output is filtered.
Better use this, because it is faster:
Get-adobject -filter {(objectclass -eq ‘contact’) -and (cn -like ‘*Peter*’)}
Regards,
Roland
LikeLike
Hi Roland, thank you for the recommendation! Regards
LikeLiked by 1 person