Solved

List all email addresses in Exchange 2010 including any forward emails

Posted on 2013-12-18
5
516 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

615 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