As Technet Gallery is retiring so moving the code to Git Hub. (click below github download link for this script)
Export AD group members – nested / recursive group members using Quest
This script is alternative to below script & it is fairly simple.
This just needs a single line of code for extracting the members recursively from the group.
(Thanks to Quest)
$members = Get-QADGroupMember $Group -Indirect | select Name, Type | Export-Csv .\members.csv
Extract the zip file above & just double click the batch file getgroupmembers.bat, it will ask you for group name.
Script will extract the output in same folder in the form of csv.