We help IT Professionals succeed at work.

Export/Import Public Folder Email Addresses

advserver
advserver asked
on
Medium Priority
1,790 Views
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.

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2013
Commented:
ADModify may be what you need for this
http://www.codeplex.com/admodify
A good overview here
http://www.msexchange.org/articles/ADModify-Change-Exchange-Specific-AD-User-Attributes.html
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
Thanks
Mike

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

Ask the Experts

Author

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.

CERTIFIED EXPERT
Top Expert 2013

Commented:
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.
Thanks
Mike
strComputer = "."
strFile = "C:\Documents and Settings\ekrengel\Desktop\Public Folder Script\Public Folders.xls"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\ROOT\MicrosoftExchangeV2")

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

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
objExcel.Workbooks.Add
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

Next

objExcel.Columns("A:C").Select
objExcel.Selection.HorizontalAlignment = 3 'xlCenter
objExcel.Selection.Borders.LineStyle = 1 '= xlSolid

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

objExcel.Columns("A:AH").EntireColumn.AutoFit

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

msgbox "Script Complete!"

Wscript.Quit

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)

err.Erase
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
Next
If Err.number then _
Primary = Mid (oPublicFolder.proxyAddresses,6)

GetProxies = Primary

End Function

Author

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

Author

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

Author

Commented:
Sandeep,
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.

OR

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.