Here is a script I put together that demonstrates how to retrieve all the groups and then retreive the contents of each group as well as the types of objects contained in the group.
In order to run the script you will need to do the following:
1 - Save the script
2 - Open the OpsMgr command shell
3 - Run the following: c:\EnumerateGroupsAndMembers.ps1