Link to home
Start Free TrialLog in
Avatar of lianne143
lianne143Flag for United States of America

asked on

How to import email addresses from a distribution group to CSV

Hi

We use exchange 2007 and outlook 2010.We have two distribution list  Staff and Students in exchange server.
Staff distribution contains 100 users and students distribution group contains 600 users.

I want to import both the staff and students names and mail addresses into a csv.
Is there a  way of importing  these email addresses .Please post me step by step tutorials.

Thanks
SOLUTION
Avatar of Jeff Lewandowski
Jeff Lewandowski

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of becraig
becraig
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lianne143

ASKER

Thanks becraig

Do I need to copy and run this command from exchange power shell  replacing <group> with staff to get all the staff name and email address?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tried entering the command and I am getting the following error.

EnabledPrimarySMTPAddressTemplate "@contoso.com"

[PS] C:\Windows\system32>Get-DistributionGroupMember #Staff Team | sort Nam
e | % {

cmdlet Get-DistributionGroupMember at command pipeline position 1
Supply values for the following parameters:
Identity:               If ($_.RecipientType -eq "UserMailbox")
Get-DistributionGroupMember : The operation could not be performed because
object '        If ($_.RecipientType -eq "UserMailbox")' could not be found on
domain controller 'DC-001.domain.local'.
At line:1 char:1
+ Get-DistributionGroupMember #Staff Team | sort Name | % {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-DistributionGroupMember],
   ManagementObjectNotFoundException
    + FullyQualifiedErrorId : FDF89F70,Microsoft.Exchange.Management.Recipient
   Tasks.GetDistributionGroupMember

[PS] C:\Windows\system32>{
>> $_.Name + " (" + $_.PrimarySMTPAddress + ")" | Out-File c:\Import\members.txt
 -Append
>> }
>> }
>>
Please let me know if I am missing any thing
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I ran the following command  and now I get the below.

[PS] C:\Windows\system32>Get-DistributionGroup -Anr StaffTeam

Name                DisplayName         GroupType                     PrimarySmtpAddress
----                -----------         ---------           ------------------
StaffTeam      StaffTeam            Universal, Secur...          StaffTeam@C...


[PS] C:\Windows\system32>
Hi becraig
Please post me as how I go with next step
Thanks
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I saved the script as address.ps1 on C: and ran this from powershell ,please see below.

PS C:\> .\address.ps1
Get-DistributionGroupMember : The term 'Get-DistributionGroupMember' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At C:\address.ps1:1 char:1
+ Get-DistributionGroupMember StaffTeam | sort Name | % {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-DistributionGroupMember:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi becraig

Thank you soo much for all your post. It worked like a charm.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Many thanks once again and I will give your points.