Exchange 2007 – Enumerate all public folders and their email addresses using Exchange Management Shell (EMS)

Ever wanted to enumerate all Public Folders and their email addresses? here’s a way to do this using Microsoft Exchange Management Shell (EMS)

Get-Mailpublicfolder | select name , alias ,EmailAddresses | foreach {
"Name: "+$_.name
"Alias: "+$_.alias
 
$_.EmailAddresses | foreach {
if($_.SmtpAddress){
if($_.IsPrimaryAddress){
"Primary SmtpAddress: $($_.SmtpAddress)"
} else {
"SmtpAddress: $($_.SmtpAddress)"
}
}
}
 
write-output ""
}

or redirect the output into a file for analysis, whatever..

Get-Mailpublicfolder | select name , alias ,EmailAddresses | foreach {
"Name: "+$_.name
"Alias: "+$_.alias
 
$_.EmailAddresses | foreach {
if($_.SmtpAddress){
if($_.IsPrimaryAddress){
"Primary SmtpAddress: $($_.SmtpAddress)"
} else {
"SmtpAddress: $($_.SmtpAddress)"
}
}
}
 
write-output ""
} | out-file -filepath c:\publicFolders.txt -encoding ASCII

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">