Get-GroupHierarchy.ps1 gets a fully recursive listing of group membership. The script is based on a script by the same name posted at https://powershell.com/cs/forums/t/9588.aspx. I made a large number of changes to the original code. This script takes the SamAccountName of a group, such as Domain\MyGroupName, and then gives you all the members of the group. If a group is a member, it indents and gets the list of members of that group. Loops throw a warning.
It writes out a text log to your desktop. I used this code as the basis of a script which I used to fix a problem with a group used in SharePoint which had buried sub groups which were not mail enabled distribution groups. I’ll post that soon.
A tip of the hat to faithful reader, Bill P. He was really surprised when I called