Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Export complete list of SMTP addresses

Posted on 2006-11-07
17
Medium Priority
?
1,058 Views
Last Modified: 2010-05-18
I need to export from AD or Exchange a complete list of SMTP addresses.  This includes all SMTP addresses, not just the primary.  Some my my users and DL's have more than one SMTP address.  I'm having trouble getting the saved queries or even adding the e-mail address column to ADUC.  Any suggestions or tips?

Thanks
0
Comment
Question by:MCPJoe
  • 5
  • 5
  • 4
  • +2
17 Comments
 
LVL 9

Expert Comment

by:trenes
ID: 17892990
Hi MCPJoe,

Do this in command prompt.

dsquery user | dsget user -email


Cheers!
0
 
LVL 39

Assisted Solution

by:redseatechnologies
redseatechnologies earned 200 total points
ID: 17893006
Hi MCPJoe,

I have used this script with major success (it will get ALL smtp addresses (up to 20))

http://www.visualbasicscript.com/m_29830/tm.htm

Hope that helps,

-red
0
 
LVL 9

Author Comment

by:MCPJoe
ID: 17893018
All I get are 100 default entries in the output, what syntax do I use the -limit argument to get all my records?
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.

 
LVL 9

Assisted Solution

by:trenes
trenes earned 200 total points
ID: 17893058
'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://DC=domain,DC=local")

'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
 
LVL 18

Assisted Solution

by:kjanicke
kjanicke earned 600 total points
ID: 17893062
Greetings:

Use the csvde command on the server.  It will let you specify which fields you want to export.

http://technet2.microsoft.com/WindowsServer/en/library/1050686f-3464-41af-b7e4-016ab0c4db261033.mspx?mfr=true

ldifde also works but hte format is different.
0
 
LVL 18

Assisted Solution

by:kjanicke
kjanicke earned 600 total points
ID: 17893093
CSVDE would be a little easier to use.  It exports it to a file that excel can read so it is easily modified and formatted.

You can specify which part of the hierarchy you want to export, and you can export specific fields in Active Directory to include smtp addresses.

When we need to move contacts to another exchange system, this is what we use.

There is alsoa  neat utility on the web called ADMODIFY which can help with bulk changes, and exports.
http://www.msexchange.org/articles/ADModify-Change-Exchange-Specific-AD-User-Attributes.html
0
 
LVL 39

Expert Comment

by:redseatechnologies
ID: 17893152
The script I posted would be a little easier again - all you have to do it run it :)
0
 
LVL 9

Author Comment

by:MCPJoe
ID: 17893155
All I really need to do is generate a list of SMTP addresses, I don't need to get the username or anything else.  ADUC saved queries only shows me the primary e-mail address.  The VB script above doesn't show me anything.  I get an error.  The link to a VB script near the top exported a list, but only of 100 or so, not nearly my complete listing.  I have multiple containers my Exchange objects are in, I need a global export of all SMTP address, and only SMTP addresses, nothing else.  Any other ideas?
0
 
LVL 9

Author Comment

by:MCPJoe
ID: 17893169
redseattechnologies - I need a listing of all SMTP addresses, your script in the link only did an output of user SMTP addresses, and none of the ones it output had more than 1 address, and I know we have several users who have more than one SMTP address, but no more than 4.  I also need SMTP addresses for mail enabled groups (DL) and also mail enabled public folders not just user accounts.
0
 
LVL 39

Expert Comment

by:redseatechnologies
ID: 17893276
Indeed, that script will not get DL addresses.

Why you are having problems with it, I don't know.  As it wont get DLs, there is little point troubleshooting it

-red
0
 
LVL 18

Assisted Solution

by:kjanicke
kjanicke earned 600 total points
ID: 17893434
csvde -f c:\ExportedList.csv -l proxyAddresses
0
 
LVL 18

Expert Comment

by:kjanicke
ID: 17893461
However -- redseatechnologies has got some excellent scripting solutions for quite a number of issues across the entire network.  I've just never learned code so I use the resources available to me.  He has provided me some great utilities!!!!
0
 
LVL 9

Author Comment

by:MCPJoe
ID: 17893486
Yeah I agree, the script was great, just not completely what I need.  I found this one - http://www.drewery.net/blog/2006/10/27/vbscript-to-export-smtp-proxy-addresses/

That works good, but not setup for public folders or DLs.  If I knew LDAP well enough I could probably set it up to do what I need.  Any LDAP guru's out there have any tips or code available that would take the code in the above link and add public folder and DL selections to the query?
0
 
LVL 18

Expert Comment

by:kjanicke
ID: 17893495
-red
I do like this code !!!  ... but it doesn't give me the secondary addresses.  
0
 
LVL 39

Expert Comment

by:redseatechnologies
ID: 17893505
Really?

I didn't write it, but let me test it out and see what is going on

-red
0
 
LVL 39

Expert Comment

by:redseatechnologies
ID: 17893565
Try this version (later on in the page)

http://www.visualbasicscript.com/fb.aspx?m=34353

It has to be run on a machine with Excel (doesn't have to be a DC though)

-red
0
 
LVL 104

Accepted Solution

by:
Sembee earned 1000 total points
ID: 17894295
I just run this:

Ldifde -d "DC=domain,DC=co,DC=uk" -r "(&(mailnickname=*))" -l proxyAddresses -f proxies.txt

replacing the DC=domain etc with the correct domain name.

Simon.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Among the most obnoxious of Exchange errors is error 1216 – Attached Database Mismatch error of the Jet Database Engine. When faced with this error, users may have to suffer from mailbox inaccessibility and in worst situations, permanent data loss.
There are literally thousands of Exchange recovery applications out there. So how do you end up picking one that’s ideal for your business & purpose? By carefully scouting the product’s features, the benefits it offers you, & reading ample reviews f…
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question