Forum Discussion
alias
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
- Roger RogerIron Contributor
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.comAnd 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
- Roger RogerIron Contributor
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
}