Forum Discussion
Mark Louie Diaz
Aug 29, 2018Copper Contributor
Get mailcontact if member of any group
Hi Tech Community, May I ask how can I accomplish the subject? I want to know before removing a mail contact if it is a member of a Distribution group. Best Regards, Mark
Joshua Bines
Mar 26, 2019Iron Contributor
VasilMichevthe need for speed? try this...
Get-ADObject -LDAPFilter "(&(objectCategory=contact)(objectClass=contact)(memberOf=*))" -Properties Name,MemberOf,CanonicalName | ft Name,CanonicalName,memberof -wrap
JeanneSophia
Dec 28, 2023Copper Contributor
This is much more efficient, I was needing members for contacts, we have huge environment so 40k of distribution lists would not be efficient to query,
I modified so
$c = get-contact (contact smtp)
Get-ADObject -Identity $c.DistinguishedName -Properties memberof |fl
and members resulted ***THANK YOU*** not sure why MS decided not to list "member of" in ECP / powershell for contacts.