Solved

List all email addresses in Exchange 2010 including any forward emails

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

758 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

19 Experts available now in Live!

Get 1:1 Help Now