1

What ways can i query my Exchange 2007 server for all email aliases used?

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.

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

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
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

---------------------------------------------

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.