Listing Member Of tab
Hi!!
Is there a way to get the distribution groups that a mailbox is "member of" by Powershell?
I'm planning to get a profile and copy the groups so I can set them on another mailbox account, I'm sure it's something very common to all of us who had to create mailboxes regularly.
Thanks in advance!
Regards
Balzak
March 4th, 2011 2:22pm
The simplest and fastest would be to use build in tools:
dsquery user -name "krystian*" | dsget user -memberof | dsget group -dn -secgrp
something like above will display all groups a user is member of with information if this is security group or not
in PS something like below
$user = [ADSI]"LDAP://CN=Krystian Zieja,OU=People,DC=projectenvision,DC=com"
$groups = $user.memberof
foreach ($group in $groups)
{
$g = [ADSI]"LDAP://$group"
# you can filter here using $g.groupType
Write-Host $g.name
}
With kind regards
Krystian Zieja
http://www.projectnenvision.com
Follow me on twitter
My Blog
Free Windows Admin Tool Kit Click here and download it now
March 4th, 2011 7:37pm
Thanks!! It Worked very well...
Didn't had time to aswer early cause I went out on vacation.
Thank you again!!
Regards
March 14th, 2011 10:25am