Home > Exchange Server, Microsoft > Exchange 2007 – Enumerate all public folders and their email addresses using Exchange Management Shell (EMS)

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
Categories: Exchange Server, Microsoft Tags:
  1. No comments yet.
  1. No trackbacks yet.
WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera