How to export secondary smtp addresses

How do I export user's secondary smtp addresses along with their primary smtp address? We have a Windows 2003 AD domain and Exchange 2003 SP2.
LVL 1
moknAsked:
Who is Participating?
 
edicerConnect With a Mentor Commented:
'Global variables
Dim Container
Dim OutPutFile
Dim FileSystem

'Initialize global variables
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("smtpaddresses.txt", True)

'Replace with valid DN of the container you want to enumerate
Set Container=GetObject("LDAP://CN=Users,DC=YourDomain,DC=com")
'Enumerate Container
EnumerateUsers Container

'Clean up
OutPutFile.Close
Set FileSystem = Nothing
Set Container = Nothing

'Say Finished when your done
WScript.Echo "Finished"
WScript.Quit(0)

'List all Users
Sub EnumerateUsers(Cont)
Dim User

'Go through all Users and select them
For Each User In Cont

Select Case LCase(User.Class)

'If you find Users
Case "user"
  'Select all proxyAddresses
  Dim Alias
  If Not IsEmpty(User.proxyAddresses) Then
    'OutPutFile.Write User.DisplayName
    For Each Alias in User.proxyAddresses
        If InStr(1,Alias,"smtp",1) > 0 Then
                  OutPutFile.WriteLine User.DisplayName & vbTab & Replace(Alias,"smtp:","",1,1,1)
                  'WScript.Echo User.DisplayName & vbTab & Replace(Alias,"smtp:","",1,1,1)
            End If
    'WScript.Echo Alias
        Next
  End If

Case "organizationalunit" , "container"

EnumerateUsers User

End Select
Next
End Sub
0
 
RogieeCommented:
Hello mokn,

CSVDE should work for you.  Run it from your Exchange server and save it as a .csv and you should be able to find secondary SMTP addresses.

http://www.ss64.com/nt/csvde.html



Regards,

Rogiee
0
 
moknAuthor Commented:
What I am hoping to find is the exact syntax to use being that I am not familiar with this export tool. Thanks.
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
RogieeCommented:
csvde -f ADExport.csv
0
 
RogieeCommented:
Hey there.  How did the CSVDEwork out for ya?
0
 
moknAuthor Commented:
I haven't tried these suggestions yet. I am hoping to get back to this next week after the Holiday's. Please keep this question open for now.

Thanks,
M.
0
 
dniconsultingCommented:
edicer's script worked for me, if that's any consolation to the question. i did change 'case "user"' to 'case "user", "group"' to include distribution groups, but it works as-is after you fill in the LDAP search string.

thanks a bunch. wish i could assign you points myself!
0
 
moknAuthor Commented:
For our environment our 'Users' OU is two levels down.  I had to change CN= to OU=
0
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.