How to list email addresses and aliases for each user?
How to list email addresses and aliases for each user? Hi All, I've been using the exchange power shell to to get a listing of all user’s primary smtp address along with each alias smtp addresses a user may have. An example of what i'm after is: Primary SMTP alias 1 alias 2 Primary SMTP alias1 and so on... I've tried several things found by searching but none do what I'm after. Any suggestions? Thanks in advance!!!
February 17th, 2010 6:08pm

Hi,Is this you are looking for?get-mailbox | select -expand emailaddresses alias Regards from
Free Windows Admin Tool Kit Click here and download it now
February 18th, 2010 7:21am

Hi, Here is a very nice script to show what u needs. #get mailboxes and iterate through each email address and shows it either primary or an alias get-mailbox | foreach{ $host.UI.Write("Blue", $host.UI.RawUI.BackGroundColor, "`nUser Name: " + $_.DisplayName+"`n") for ($i=0;$i -lt $_.EmailAddresses.Count; $i++) { $address = $_.EmailAddresses[$i] $host.UI.Write("Blue", $host.UI.RawUI.BackGroundColor, $address.AddressString.ToString()+"`t") if ($address.IsPrimaryAddress) { $host.UI.Write("Green", $host.UI.RawUI.BackGroundColor, "Primary Email Address`n") } else { $host.UI.Write("Green", $host.UI.RawUI.BackGroundColor, "Alias`n") } } } Save this entire script as a .ps1 file (Powershell script file) e.g "ShowEmailIDs.ps1", and then place it in the "Scripts" folder in MS Exchange Installation folder which is noramlly "C:\Program Files\Microsoft\Exchange Server\Scripts". Then open Exchange Management Shell and just type the name of .ps1 file e.g. ShowEmailIDs.ps1 and press enter. It will show result like this User Name: Administrator Alias Administrator@domain.lab Primary Email Address User Name: mailbox1 Alias mailbox1@domain.lab Primary Email Address Note: U can also put a filter for get-mailbox in above mentioned script to run this script for a specific domain like this get-mailbox | Where{ $_.PrimarySmtpAddress -like "*domain.lab" }| foreach{ Regards, Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM)
February 21st, 2010 1:43am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics