Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

List all email addresses in Exchange 2010 including any forward emails

Posted on 2013-12-18
5
Medium Priority
?
542 Views
Last Modified: 2014-06-27
I need to modify the following scripts so that any emails which have forwards associated with them will also be shown:

Get-recipient -resultsize unlimited | select Name -expand emailaddresses | Select SmtpAddress

or

Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}} > C:\Addresses\emailaddresses.txt

or

Get-recipient -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}} | Export-Csv c:\mailbox_alias.csv
0
Comment
Question by:100questions
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:Vaseem Mohammed
ID: 39734402
I came up with this script for you.
Tested it in my environment and the results are as expected, give output on screen as well in a csv format which includes Name, Alias and forward Address associated to each account.

Hope it help.

$report = @()

$MBColl = Get-Mailbox -ResultSize Unlimited | where{$_.ForwardingAddress -ne $null }
foreach($MB in $MBColl){

    $FFAddrFQDN = $MB.ForwardingAddress
    $FFAddr = Get-MailContact -Identity "$FFAddrFQDN"

    $objA = new-object psobject
    $objA | Add-Member NoteProperty -Name "User Name" -Value $MB.Name
    $objA | Add-Member NoteProperty -Name "Alias" -Value $MB.Alias
    $objA | Add-Member NoteProperty -Name "Forward Address" -Value $FFAddr.PrimarySMTPAddress

    $report = $report += $objA
    }
 $report | FT

 $report | Export-Csv -Path c:\Get-ForwardAddress-Report.csv -NoTypeInformation

Open in new window

0
 

Author Comment

by:100questions
ID: 39756016
Is this an Exchange script?  If yes, how to  you run it?
0
 
LVL 12

Expert Comment

by:Vaseem Mohammed
ID: 39756956
Yes, its a script that need to be run from "Exchange Management Shell"EMS1Copy the script into a notepad and "Save as" name it as u like but put the name in quotes "" with file extension as ".ps1"save asUsing Exchange Management Shell, browse to the directory where you saved the file and type .\Get-ForwardingAddress.sp1
Note that the output will seen in EMS as well as .csv file will be saved on C drive.
You can change the path in the very last line of script.
0
 
LVL 12

Accepted Solution

by:
Vaseem Mohammed earned 2000 total points
ID: 39765278
any help needed?
0
 

Author Closing Comment

by:100questions
ID: 40163165
Might work, I need to ask a question.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question