This script will retrieve the name of groups and their members. The first loop (for each) can transform the AD property in string. Once transformed values are exported to a csv file.
The arguments returned are present in the instruction select cn, member. You can add an other attributes.
It is necessary to enter in the script the ldap path for the organizational Unit desired.