Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

Powershell Command - email address for all users in a group

need to export all the email addresses in a Active directory Group to csv
0
Jorge Ocampo
Asked:
Jorge Ocampo
  • 3
  • 2
1 Solution
 
Rajitha ChimmaniCommented:
Run the below command in Exchange Management shell

Get-DistributionGroupMember groupname | Select PrimarySMTPaddress | export-csv filepath -notypeinformation
0
 
Jorge OcampoAuthor Commented:
what does the last "-notypeinformation" do?
0
 
Jorge OcampoAuthor Commented:
i also got this message:

WARNING: By default, only the first 1000 items are returned. Use the ResultSize parameter to specify the n
items returned. To return all items, specify "-ResultSize Unlimited". Be aware that, depending on the actu
items, returning all items can take a long time and consume a large amount of memory. Also, we don't recom
the results in a variable. Instead, pipe the results to another task or script to perform batch changes.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Rajitha ChimmaniCommented:
Usually in csv output it gives you the attribute type in the first line. if you add this it would skip the type information which is not of any use.
0
 
Rajitha ChimmaniCommented:
Use this to avoid the warning

Get-DistributionGroupMember groupname -Resultsize unlimited | Select PrimarySMTPaddress | export-csv filepath -notypeinformation
0
 
NVITCommented:
Maybe these will help to export those addresses:

Powershell Script to export AD user to a CSV file?
http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_28356892.html

Powershell: Export active users' firstname, lastname & email address to CSV
http://www.experts-exchange.com/Software/Server_Software/Active_Directory/Q_28022171.html

Export DisplayName, Email Address and Title From AD to CSV File:
http://community.spiceworks.com/how_to/show/86794-powershell-how-to-export-displayname-email-address-and-title-from-ad-to-csv-file
0

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

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