PS command to export PF email addresses on E2K7
We have a huge number of public folders and we need to identify all of the SMTP addresses (and secondary SMTP addresses etc.) of the mail-enabled public folders on Exchange 2007 under a specific location (i.e. \TopLevel\Subfolder). Ideally would like to
get the folder name, folder path, and the primary/secondary email addresses. Can anyone point me in the right direction? Thanks!
January 10th, 2011 8:41am
Hi,
How much time you wait once put cmdlet, it could take some seconds to execute it, also give a try again with below cmdlet.
#Add a replica of all public folders to the new 2007 Public folder databases
CD “C:\Program Files\Microsoft\Exchange Server\Scripts”
.\AddReplicaToPFRecursive.ps1 -TopPublicFolder \ -ServerToAdd Exch2007
http://www.msexchange.org/articles_tutorials/exchange-server-2007/migration-deployment/exchange-2007-install-configuration-command-line-part3.html
Anil
Free Windows Admin Tool Kit Click here and download it now
January 10th, 2011 11:07am
Try get-mailpublicfolder | fl alias,emailaddresses which gets you email address. Path is ParentPath, not sure if you can add that to the fl option (not in front of a machine to try).
January 10th, 2011 12:06pm
I can get the name and email addresses, but there doesn't seem to be a parentpath parameter or a recurse switch to go through the subfolders. I am thinking that it's going to incorporate get-publicfolder and piping out to get-mailpublicfolder somehow.
One other concern is that a lot of our PF's are from the 5.5 days and I get the complaint about the Alias not being in the right format (generally because of spaces) - is there a way to suppress these?
Free Windows Admin Tool Kit Click here and download it now
January 10th, 2011 12:46pm
Credit to Chris Dent @ ExpertsExchange for the following:
Get-PublicFolder -Recurse -resultsize unlimited -server "exchange server" -id "\example folder\example folder 1" | `
Select-Object Name, Path, `
@{n='EmailAddresses';e={
"$((Get-MailPublicFolder $_.Identity).EmailAddresses | %{ $_.ProxyAddressString })" }} | `
Export-CSV $File
January 10th, 2011 2:07pm
On Mon, 10 Jan 2011 19:02:59 +0000, Chris Scharff wrote:
>
>
>Credit to Chris Dent @ ExpertsExchange for the following:
>
>Get-PublicFolder -Recurse -resultsize unlimited -server "exchange server" -id "\example folder\example folder 1" | ` Select-Object Name, Path, ` @{n='EmailAddresses';e={ "$((Get-MailPublicFolder $_.Identity).EmailAddresses | %{ $_.ProxyAddressString })"
}} | ` Export-CSV $File
The "Path" in the above code needs to be "ParentPath". :-)
Sometimes "one-liners" make it hard to understand what's happening.
This "unwinds" the processing and, as an added benefit, separates the
multiple values of the emailaddresses property with tab characters:
##############################################
$pfinfo = @()
Get-PublicFolder -Recurse -resultsize unlimited -server "<server>" `
-id "\" | foreach {
$n = $_.name
$pp = $_.parentpath
$ema = (get-mailpublicfolder $_.identity `
-ea silentlycontinue).emailaddresses
$addrs = @()
foreach ($addr in $ema)
{
$addrs += $addr.proxyaddressstring
}
$pas = [string]::join("`t", $addrs)
$pf = new-object psobject
$pf | Add-Member NoteProperty Name $n
$pf | Add-Member NoteProperty ParentPath $pp
$pf | Add-Member NoteProperty EMailAddresses $pas
$pfinfo += $pf
}
$pfinfo | export-csv PFInfo.csv -notypeinfo -encoding ascii
#################################################
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
January 10th, 2011 10:23pm
Thank you Chris and Rich - both of those scripts got me what I needed!
Dave
January 13th, 2011 2:45pm