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

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

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 *

This site uses Akismet to reduce spam. Learn how your comment data is processed.