We help IT Professionals succeed at work.

Export/Import Public Folder Email Addresses

advserver asked
Medium Priority
Last Modified: 2012-05-06
A company recently merged with another company and we are inthe process of performing a cross forest migration. While all is done, there is one step that i need some help with.

we have over 13000 public folders that have been replicated using the inter-org replication tool. The problem here is that, around 5000 of them are mail-enabled.

Without going through all of them manually, is there an easy way to add additional smtp (proxyaddresses) to all of them. Or export that list from the old forest and import into the new forest? All folders have the same name, but are in the new forest.

Any suggestions are appreciated.

Watch Question

Top Expert 2013
ADModify may be what you need for this
A good overview here
I've used admodify in production but never for public folders and I don't have any in my lab to test with or I would.
Seems like you should be able to add the address.
Hope that helps

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


i have used admodify 1.6 and 2.0, but like you never for public folders, i did query the directory and found 1619 public folders, i am wondering why i only found that many. I am sure that i have over 5000 that are mail enabled.

i was trying to think of a way to update these via RUS, but that doesnt appear to be working, even if i use admodify and select update based on RUS.

Top Expert 2013

That is interesting;
I wonder if an adfind command would find mroe
something like
adfind -default -f  "&(objectcategory=publicfolder)(proxyaddresses=*)"
Wish I had a system with mail enabled public folders to test this on.
strComputer = "."
strFile = "C:\Documents and Settings\ekrengel\Desktop\Public Folder Script\Public Folders.xls"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _

Set colItems = objWMIService.ExecQuery _
("Select * from Exchange_PublicFolder")

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
objExcel.Cells(1,1).Value = "All Public Folder in Domain "
objExcel.Cells(1,1).Font.Bold = True
objExcel.Cells(1,1).Font.Size = 13
objExcel.Cells(1,1).Interior.ColorIndex = 11
objExcel.Cells(1,1).Interior.Pattern = 1 'xlSolid
objExcel.Cells(1,1).Font.ColorIndex = 2
objExcel.Cells(1,1).Borders.LineStyle = 1 '= xlSolid
objExcel.Cells(1,1).WrapText = True

objExcel.Cells(2,1).Value = "Time: " & Now
objExcel.Cells(2,1).Font.Bold = True
objExcel.Cells(2,1).Font.Size = 12
objExcel.Cells(2,1).Interior.ColorIndex = 11
objExcel.Cells(2,1).Interior.Pattern = 1 'xlSolid
objExcel.Cells(2,1).Font.ColorIndex = 2
objExcel.Cells(2,1).Borders.LineStyle = 1 '= xlSolid
objExcel.Cells(2,1).WrapText = True

objExcel.Cells(4,1).Value = "Folder Name"
objExcel.Cells(4,1).Font.Bold = True
objExcel.Cells(4,1).Font.Size = 11
objExcel.Cells(4,2).Value = "Email Address"
objExcel.Cells(4,2).Font.Bold = True
objExcel.Cells(4,2).Font.Size = 11
objExcel.Cells(4,3).Value = "Creation Time"
objExcel.Cells(4,3).Font.Bold = True
objExcel.Cells(4,3).Font.Size = 11

x = 5
y = 1

For Each PFolder in colItems
strProxyAddresses = "IsMailEnabled= False"
strDisplayName = PFolder.AddressBookName
strSecondary = ""
Secondary = ""
If PFolder.IsMailEnabled=TRUE then
strProxyAddresses = GetProxies(strDisplayName)
End If

y1 = y
objExcel.Cells(x,y1).Value = strDisplayName
y1 = y1 + 1
objExcel.Cells(x,y1).Value = strProxyAddresses
y1 = y1 + 1
objExcel.Cells(x,y1).Value = PFolder.CreationTime
x = x + 1 'go to the next Row


objExcel.Selection.HorizontalAlignment = 3 'xlCenter
objExcel.Selection.Borders.LineStyle = 1 '= xlSolid

objExcel.Range("A1","C1").MergeCells = 1
objExcel.Range("A2","C2").MergeCells = 1


objExcel.DisplayAlerts = False
Set objWorkbook = objExcel.ActiveWorkbook
objWorkbook.SaveAs strFile

msgbox "Script Complete!"


Function GetProxies(AddressBookName)
on error resume next
Primary = ""
Secondary = ""
Set rootDSE = GetObject("LDAP://RootDSE")
DomainContainer = rootDSE.Get("defaultNamingContext")

Set conn = CreateObject("ADODB.Connection")
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"

ldapStr = "<LDAP://" & DomainContainer & ">;(&(&(&(&" & _
"(| (objectCategory=publicFolder) )))(objectCategory=publicFolder)" & _
"(displayName="& AddressBookName &")));adspath;subtree"

Set rs = conn.Execute(ldapStr)

Set oPublicFolder = GetObject(rs.Fields(0).Value)

For each email in oPublicFolder.proxyAddresses
If Left(email,5) = UCase("SMTP:") Then
Primary = Mid (email,6)
'Exit For
ElseIf Left(email,5) = LCase("smtp:") Then
Secondary = Mid (email,6) & "; " & Secondary
End If
If Err.number then _
Primary = Mid (oPublicFolder.proxyAddresses,6)

GetProxies = Primary

End Function


thanks for the script sandeep, could you explain a bit more on this for me please.
it appears to be two scripts. any additional assistance would be greatly appreciated.

There's only one script at the end i have two functions


thanks again, i will try this in my lab. I will let you know


i put the script on my exchange server as a .vbs and ran in, the command shell appears and that is about all. Could you possibly provide additional instructions for me?
i have resolved this myself..but it did take a script.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.