What ways can i query my Exchange 2007 server for all email aliases used?
Asked
Active
Viewed 5,461 times
4 Answers
3
This should get you a list
Get-Mailbox | fl UserPrincipalName, Emailaddresses, PrimarySMTPaddress
This command will show you the user, smtp addresses and the primary address.

Frands Hansen
- 4,657
- 1
- 17
- 29
2
Sorry i didn't answer sooner, I ended up working a bit on my Google-fu and came up with the following which gave me the entire list of email addresses, primary or aliases for my entire domain. Thanks!
http://exchangepedia.com/2005/09/how-to-export-all-email-addresses-from-a-domain.html

David Yenglin
- 185
- 1
- 8
0
Here it is mate:
Get-Mailbox -resultSize unlimited | foreach{
$emails= $_ | select -expand EmailAddresses | where {$_.PrefixString -eq 'smtp'} | sort IsPrimaryAddress -desc | foreach {$_.smtpAddress}
[string]::join(",",$emails)
} > C:\alias.txt

Senior Systems Engineer
- 1,275
- 2
- 33
- 62
0
This will output a list in human-readable format. I couldn't quickly figure out how to remove the "SmtpAddress" line on the first item, but you can edit that out fairly easily in Notepad.
Write-Host "SMTP Aliases";
foreach ($mailbox in Get-Mailbox | Sort-Object OrganizationalUnit, DisplayName) {
Write-Host;
Write-Host $mailbox.DisplayName;
Write-Host $mailbox.OrganizationalUnit;
Write-Host "========================";
Get-Mailbox $mailbox -filter {EmailAddresses -notlike '*X400:*' -and EmailAddresses -notlike '*X500:*'} | Select-Object -expand EmailAddresses | Select-Object SmtpAddress
Write-Host;
Write-Host "---------------------------------------------";
}
Sample Output
Administrator
domain.local/Users
========================
SmtpAddress
-----------
Administrator@webdomain.com
Administrator@domain.local
---------------------------------------------
Discovery Search Mailbox
domain.local/Users
========================
DiscoverySearchMailbox{D919BA05-46A6-415f-80AD-000000000000}@webdomain.com
DiscoverySearchMailbox{D919BA05-46A6-415f-80AD-000000000000}@domain.local
---------------------------------------------
Jane Doe
domain.local/Users
========================
info@webdomain.com
helpdesk@webdomain.com
jane@webdomain.com
jane@domain.local
---------------------------------------------

Oran D. Lord
- 101
- 1