How to Export AD user list with email addresses
If you have the need to export a user list from an Active Directory group along with the user’s email address, run the following command in PowerShell as an administrator.
If your AD has the e-mail attribute filed out:
Powershell
Get-ADGroupMember -Identity “groupname” -Recursive |
Get-ADUser -Properties Mail |
Select-Object Name,Mail |
Export-CSV -Path C:\file.csv -NoTypeInformation
Example:
If not you can get it from Exchange too, if thats what you use. 2010:
PowerShell
Get-DistributionGroupMember -Identity “groupname” |
Select-Object Name,PrimarySMTPAddress |
Export-CSV -Path C:\file.csv -NoTypeInformation