Solved

List all email addresses in Exchange 2010 including any forward emails

Posted on 2013-12-18
5
496 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

912 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now