AD power shell module command help please

Hello Total Noob here,

The command below works just fine and pulls all the user names from within the “AD Group Name” I enter and exports them to an excel file under the A column. I would like to also have it pull each users Active Directory OU location and place it under the B column.

My question is what do I need to add to the code below to achieved this? Thank you in advance for all your help.

get-adgroupmember -identity "AD Group Name" | Select name | Export-csv -path C:\Output\Groupmembers.csv -NoTypeInformation


[pre]Get-ADGroupMember GROUP |
Select-Object name, @{
Expression={$PSItem.DistinguishedName -replace “^.*?,(?=OU=)”}
} | Export-Csv -Path C:\Output\Groupmembers.csv -NoTypeInformation[/pre]


Thank you so much Wes this was exactly what I needed to pull, thank you again for the help!