[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6965
  • Last Modified:

Get Email addresses from members of an AD Group

I am trying to find a vb/powershell script that will extract email addresses from members within an active directory group.

This group and it's members are not part of Exchange.

I know Get-AdGroupMember lists the members of the group but this does not give me their email addresses.

Any ideas?

thanks in advance
1 Solution
If you install the free Quest PowerShell Tools (http://www.quest.com/powershell/) , you can do this:

get-qadgroup MyGroupName | get-qadgroupmember | select primarysmtpaddress

Open in new window

It will output only the email addresses. If you want their names as well, change the select statement to:

get-qadgroup MyGroupName | get-qadgroupmember | select name,primarysmtpaddress

Open in new window

You may also try piping the output of your Get-Adgroupmember output to " |select primarysmtpaddress" or "| select email"

With that in mind, the Quest PowerShell tools are awesome and very handy.
Krzysztof PytkoActive Directory EngineerCommented:
Just pipe output to another cmd-let and select E-Mail parameter. Try this

Get-ADGroup "GroupName" | Get-ADGroupMember -Recursive | Get-ADUser -Properties * | Select SamAccountName,GivenName,sn,Mail | Export-CSV c:\users.csv

Open in new window

awgitAuthor Commented:
thanks this worked, except I had to replace primarysmtpaddress with email

you rock!
Sidry RoxCommented:
Thanks a lot!

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now