This code will find all groups to which a particular email account or mail-user
account belongs.
get-group | where-object -FilterScript {$_.Members -contains $user}
However, in O365 you can have mail-contacts
who are not users - they are used just for mailing lists; they don't have a windowsliveid
, so they won't be found in $_.Members
.
How can I find all groups that a particular mail-contact
belongs to?