I think @Rafael da Rocha had it almost right. Revamping his code a bit to place the membership of each group into a separate CSV was, I think, what you were looking for though.
Since you only want the membership of the main group and its immediate child groups you can do this without using recursion:
$Input_Users = "Name,Description,UserprincipalName,SamAccountName,office,DepartmentNumber,Department" -split ','
$GroupNames = @()
# get the users in the main group
Get-ADGroupMember -Identity "GP1" |
ForEach-Object {
if ($_.objectClass -eq "user") {
Get-ADUser $_.SamAccountName -Properties $Input_Users | Select-Object $Input_Users
}
elseif ($_.objectClass -eq "Group") {
$GroupNames += $_.distinguishedName
}
} | Export-Csv -Path C:\temp\ParentGroupUsers.csv -NoTypeInformation
# get the users (ignoring other ogject types) that are members of each child group
# place the users in a unique CSV for each group
ForEach ($group in GroupNames){
$g = "c:\temp\{0}.csv" -f (Get-ADGroup -Identity $group).Name
Get-ADGroupMember -Identity $group |
ForEach-Object{
Get-ADUser $_.SamAccountName | Select-Object $Input_Users
} | Export-Csv $g -NoTypeInformation
}