Export/Import Public Folder Email Addresses

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.

Who is Participating?
advserverConnect With a Mentor Author Commented:
i have resolved this myself..but it did take a script.
Mike KlineConnect With a Mentor Commented:
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
advserverAuthor Commented:
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.

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Mike KlineCommented:
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.
sandeep_narkhedeConnect With a Mentor Commented:
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
advserverAuthor Commented:
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
advserverAuthor Commented:
thanks again, i will try this in my lab. I will let you know
advserverAuthor Commented:
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?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.