locked
List group membership for all Contacts in an OU RRS feed

  • General discussion

  • Hi there, I need to output a list of all the groups that each contact (in a specific OU) belongs to.

    I can list the contacts in both the Exchange Management Shell, and using the Quest cmdlets, using the following commands:

    Get-Contact -ResultSizeUnlimited -OrganizationalUnit "Domain/OrganizationalUnit"

    get-QADObject -SizeLimit 0 -Type 'contact' -OrganizationalUnit "Domain/OrganizationalUnit"

    How do I then output each contact's group membership?

    Thanks in advance.

    Thursday, April 19, 2012 6:53 AM

All replies

  • put those contacts in a csv file.

    contacts

    externaluser1@compan1.com

    externuser2@company2.com

    import-csv testfile.txt |foreach {get-qadobject $_.contacts} |select name, memberof


    James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com

    Thursday, April 19, 2012 5:38 PM
  • Thanks so much James, this is perfect!

    For anybody else, I've been able to combine this into two lines that perform what I need - using the Quest cmdlets:

    get-QADObject -SizeLimit 0 -Type 'contact' -OrganizationalUnit "YourDomain/OrganizationalUnitName" | Export-CSV Contacts.txt

    import-csv Contacts.txt |foreach {get-QADobject $_.PrimarySMTPAddress} | ft name, memberof -wrap >contactgroupmembership.txt

    Obviously would need to change "YourDomain/OrganizationalUnitName" to your domain name & OU.

    Thanks again James!

    Friday, April 20, 2012 2:23 AM