When I export my group data from exchange/AD I am left with the full domain name, including CN=, OU=, OU=, ect. Is there something I can change in my script to get it to export just the name, instead of having to go into excel and search and replace what I dont want?

```
#Written by Tekwhat 10-26-17
write-host "Group Memberships"
#Settings for file ouput
$fLocation = "D:\Exchange Reports\O365 Reports\"

import-module activedirectory

#Get OU
$OU = Read-Host -Prompt "Input the OU name to search: (0202 - Dev Bank)"

#create File to write report to:
$fName = $fLocation+$OU+" Group Memberships.csv"
$test = test-path $fName
    if ($test -eq $True)
        {
            write-host "Removing Old File..." -ForeGroundColor Red
            Remove-Item $fName
        }
    #Else
        #{
            #New-Item $fName -type file
        #}
Write-host "Creating New File..." -ForeGroundColor darkgreen
New-Item $fName -type file

$SearchBase = "OU=$OU,OU=Hosted Exchange Customers,DC=Domain,DC=local"
$ADGroups = Get-ADGroup -Filter * -SearchBase $SearchBase | % { [ADSI]("LDAP://$_") }

$Members = @()

foreach ($ADGroup in $ADGroups){
              $Members += $ADGroup.Member |
                           Select -Property @{Name="ADGroup";Expression={$ADGroup.cn}},
                           @{Name="Member";Expression={$_}}
}

$Members | Select-Object AdGroup, Member | Export-Csv -Path $fname -NoType
write-host "Your file is located at " $fname -ForegroundColor DarkGreen

```

The export of above gives something like this:

> 
> "All Employees","CN=Test X User,OU=OUname,OU=Hosted Exchange
>  Customers,DC=Domain,DC=local"
> 
> 
> 

Which I have to go into excel and search replace "CN=" and "OU=OUname,OU=Hosted Exchange
Customers,DC=Domain,DC=local" to have usable data.