MVTechies
asked on
Exchange 2007 PowerShell Command
How do you export all the email addresses and aliases and sort by domains?
The command below does export all the information but not by domain order.
Get-Mailbox | select name , alias ,EmailAddresses | foreach {
"Name: "+$_.name
"Alias: "+$_.alias
$_.EmailAddresses | foreach {
if($_.SmtpAddress){
if($_.IsPrimaryAddress){
"Primary SmtpAddress: $($_.SmtpAddress)"
} else {
"SmtpAddress: $($_.SmtpAddress)"
}
}
}
write-output ""
} > c:\email-aliases.txt
Just to clarify i want to list all the @test.com in one row and then @test1.com in row 2 etc.
thanks
The command below does export all the information but not by domain order.
Get-Mailbox | select name , alias ,EmailAddresses | foreach {
"Name: "+$_.name
"Alias: "+$_.alias
$_.EmailAddresses | foreach {
if($_.SmtpAddress){
if($_.IsPrimaryAddress){
"Primary SmtpAddress: $($_.SmtpAddress)"
} else {
"SmtpAddress: $($_.SmtpAddress)"
}
}
}
write-output ""
} > c:\email-aliases.txt
Just to clarify i want to list all the @test.com in one row and then @test1.com in row 2 etc.
thanks
ASKER
Rancy - thanks for the information. However i am after the following format.
first@test.com
second@test.com
third@test.com
and then a list of
first@test2.com
second@test2.com
third@test2.com
etc etc....
Users here have multiple email addresses - the main smtp and then aliases and i want to separate them completely in order of domain i.e. test.com and them test2.com.
thanks
first@test.com
second@test.com
third@test.com
and then a list of
first@test2.com
second@test2.com
third@test2.com
etc etc....
Users here have multiple email addresses - the main smtp and then aliases and i want to separate them completely in order of domain i.e. test.com and them test2.com.
thanks
Ok..We can sort it out but do you want to sort with PrimarySMTPaddress domain or the normal SMTPAddress domain from your script?
ASKER
Just by domain address...
list of all the @test.com for all users all mailboxes in Exchange and then @test2.com and then @test3.com etc.
We need this in either txt or csv format for importing purposes.
thanks
list of all the @test.com for all users all mailboxes in Exchange and then @test2.com and then @test3.com etc.
We need this in either txt or csv format for importing purposes.
thanks
While i can work on it...can you tell me which attributes or values must be written in txt or csv file? Just email addresses?
ASKER
Just email addresses including aliases and distribution groups are required but sorting on domain name only.
thanks again.
thanks again.
Distributiongroups? Which distributiongroups? This was not there in your first script.
ASKER
Exchange Distribution Groups if possible. I couldn't find the command for that but if its possible that would be great too.
thanks
thanks
Do you mean the distribution groups to which that mailbox is memberof? Or the aliases and email addresses of the distribution groups?
ASKER
Aliases and email addresses of the distribution groups please.
We need a full export to csv/txt that lists all the email addresses by domain name in different columns.
We need a full export to csv/txt that lists all the email addresses by domain name in different columns.
Get-Mailbox | Sort-Object EmailAddresses –Descending | ft name , alias ,EmailAddresses
What if you try with the above count ?
- Rancy
What if you try with the above count ?
- Rancy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for this. It works a treat.
Could you please do the same for distribution groups as well?
Could you please do the same for distribution groups as well?
Use Get-DistributionGroup instead of Get-Mailbox
ASKER
Working brilliantly. Thanks for helping.
I've also added in Get-MailPublicFolder which does exactly that in the same format as the others.
Much appreciated.
I've also added in Get-MailPublicFolder which does exactly that in the same format as the others.
Much appreciated.
ASKER
Fantastic response and turnaround provided.
My pleasure. Enjoy reporting :)
- Rancy