Question: I'm trying to script something where I can get the email address of all users in an active directory security group.

What I have so far:

```
$Groups = Get-ADGroup -filter {Name -like "VIPEmail" } | Select-Object Name
ForEach ($Group in $Groups) {
  Get-ADGroupMember -identity $($group.name) -recursive | Select-Object samaccountname
}

```

Obviously this will only return the samaccountname, which it does. I replace samaccountname with EmailAddress, and it does nothing.

Answer: 
Something like this:'

```
Get-ADGroup -filter {name -like 'VIPEmail'} | 
Get-ADGroupMember -Recursive |
Get-ADUser -Properties Mail |
select -ExpandProperty Mail

```
I went with:

```
Get-ADGroupMember -Identity your_ad_group_name_here -Recursive | Get-ADUser -Properties *  | Select SamAccountName,mail,EmailAddress,Manager

```

...just make sure you've installed the necessary powershell module so you have access to `Get-ADGroupMember`. You can download the `WindowsTH-RSAT_WS_*` specific to your version of Windows 10 here - <https://www.microsoft.com/en-us/download/details.aspx?id=45520>.