export email address as array list

%3CLINGO-SUB%20id%3D%22lingo-sub-2104533%22%20slang%3D%22en-US%22%3Eexport%20email%20address%20as%20array%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2104533%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20export%20a%20list%20of%20users%20email%20address%20in%20array%20format..%3C%2FP%3E%3CP%3Esay%20I%20have%2010%20users%20in%20a%20CSV%20file%20(displayname)%3C%2FP%3E%3CP%3ENeed%20a%20command%20to%20export%20their%20emailaddresses%20in%20array%20type%3C%2FP%3E%3CP%3Eexample%3A%3C%2FP%3E%3CP%3Ecolum1%20should%20have%20name%3C%2FP%3E%3CP%3Ecolumn2%20should%20have%201%20smtpaddress%3C%2FP%3E%3CP%3Ecolum%203%20should%20have%20the%20other%20smtpaddress%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ecan%20someone%20help%20pls%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2104533%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2105012%22%20slang%3D%22en-US%22%3ERe%3A%20export%20email%20address%20as%20array%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2105012%22%20slang%3D%22en-US%22%3E%3CP%3EUse%20PrimarySmtpAddress%20for%20the%20second%20column%2C%20and%20something%20like%20(%24_.EmailAddresses%20-join%20%22%3B%22)%20for%20the%20third.%20The%20syntax%20will%20depend%20on%20whether%20you%20are%20running%20this%20against%20EMS%20or%20Remote%20Exchange%20PowerShell.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I am trying to export a list of users email address in array format..

say I have 10 users in a CSV file (displayname)

Need a command to export their emailaddresses in array type

example:

colum1 should have name

column2 should have 1 smtpaddress

colum 3 should have the other smtpaddress

 

can someone help pls

3 Replies

Use PrimarySmtpAddress for the second column, and something like ($_.EmailAddresses -join ";") for the third. The syntax will depend on whether you are running this against EMS or Remote Exchange PowerShell.

@vignesh_Learn 

 

$Myusers=@("Firstname LastName","FirstName1 LastName1")
$Myusers.foreach{Get-ADUser -Properties mail,proxyAddresses -Filter "displayname -like '$_'" | ft mail,proxyAddresses  }

 

 

Use this method if you don't have Exchange Management Shell or want to get the information via Active Directory.

 

@Vasil Michev I am running this in Remote exchange powershell.