alias

Brass Contributor

Hi experts, i am not able to put in correct words

i have a csv file with email addresses
with the help of email addresses i.e with csv file, is it possible to get generate report of alias
and SMTP email address (these email addresses have additional SMTP email address)
Please help me with the syntax

(in other words our company email policy is firstname.lastname@mydomain.com, the csv file i have is firstname.lastname@mydomain.com

when i click mailbox-general-Alias- i need alias names
and email addresss-i can see mutliple email addresses
i.e SMTP:roger.federer@mydomain.com
    SMTP:roger.f@mydomain.com
i want to sort all these 

4 Replies

Not really sure what you mean, but assuming I got it right, try this:

 

Import-csv blabla.csv | % { Get-Mailbox $_.SMTP | select Alias, EmailAddresses }

 

If you want a detailed report of all aliases in your domain, you can use this script: https://gallery.technet.microsoft.com/Office-365-aliases-b3937767?redir=0

Hi i have used the below syntax

Import-csv C:\emails.csv | % { Get-Mailbox $_.SMTP | select Alias, EmailAddresses }

in emails.csv files i have email addresses in the below format,i have tested with 2 emails in csv file
user1@mydomain.com
user2@mydomain.com

The output i am getting is for all the email addresses it is not picking from the csv file.
i only want to pull the report from csv file

Alias                                                     EmailAddresses
-----                                                     --------------
user1                                             {smtp:user1.test@mydomain.com, SMTP:user1@mydomain.com}
user2                                             {smtp:user2.test@mydomain.com, SMTP:user2@mydomain.com}
user4                                             {SMTP:user4@mydomain.com}
user5                                             {SMTP:user5@mydomain.com}
user6                                             {SMTP:user6@mydomain.com}
user7                                             {SMTP:user7@mydomain.com}
user8                                             {SMTP:user8@mydomain.com

And also i am not able to export to proper format when i tried below syntax

Import-csv C:\emails.csv | % { Get-Mailbox $_.SMTP | select Alias, EmailAddresses } | export-csv C:\output.csv -NoTypeInformation



even i tried the below syntax, i am not getting alias name and i am getting output for only the first email id in csv file

for example in emails.csv i have user1@mydomain.com and user2@mydomain.com, i am getting output for first email id.

$users=import-csv C:\emails.csv
ForEach($user in $users){
Get-Recipient $user.email | Select Name -ExpandProperty EmailAddresses |export-csv C:\output.csv -notypeinformation
}

Well I cannot guess what you have in the CSV, my example above assumes that all the addresses are under a column named "SMTP". If you are using another name, simply replace it accordingly. Or use the script I linked to.