Hi IT,
I recommend you use AD cmdlets after you get user membership of the group:
$groupName = "YourDistributionGroupName"
Get-DistributionGroupMember -Identity $groupName | ForEach-Object {
$user = Get-ADUser -Identity $_.SamAccountName -Properties DisplayName, EmailAddress
[PSCustomObject]@{
DisplayName = $user.DisplayName
PrimarySMTPAddress = $user.EmailAddress
}
}
Let me know if this working for you.
Cheers,
Luis Arias
If the information helped address your question, please Accept the answer.