HW90
HW90

Reputation: 1983

get contacts distributiongroups

I'm creating a script to manage contacts and users on Exchange 2010 via Powershell. Especially we try to get all distributiongroups of a contact/user.

Is there a way to get the distribution groups of a contact/user? Perhabs without searching in all distributiongroups?

Upvotes: 2

Views: 8853

Answers (2)

pete.si
pete.si

Reputation: 103

I had errors following the command above, the following tweek worked for me.

(Get-ADObject -Identity $contact.Guid -Properties 'MemberOf' | Select-Object MemberOf).MemberOf

Upvotes: 1

tophatsteve
tophatsteve

Reputation: 1081

It can be done by using Get-ADObject using the contact's guid:

$contact = Get-MailContact domainname\contactname
(Get-ADObject -Identity $contact.Guid -Properties 'MemberOf').MemberOf

Upvotes: 1

Related Questions