RE: Making list of e-mail addresses

  • From: "Michael B. Smith" <michael@xxxxxxxxxx>
  • To: "[ExchangeList]" <exchangelist@xxxxxxxxxxxxx>
  • Date: Thu, 24 Jun 2004 14:35:29 -0400

I think your LDAP string, specifically msExchHomeServerName, is probably

This is a whole lot simpler, if you don't need pretty formatting:

Download adfind from, then:
adfind -b dc=brnets,dc=local -f "(proxyaddresses=smtp:*)" proxyAddresses
Obviously, replace the base with your base. 

-----Original Message-----
From: John Tolmachoff (Lists) [mailto:johnlist@xxxxxxxxxxxxxxxxxxx] 
Sent: Thursday, June 24, 2004 2:25 PM
To: [ExchangeList]
Subject: [exchangelist] Making list of e-mail addresses

I am trying to make a list of users e-mail addresses.

I followed the article

And I ended up with this file:
Dim rootDSE, domainObject
Set rootDSE=GetObject("LDAP://RootDSE";)
DomainContainer = rootDSE.Get("defaultNamingContext")
Set fs = CreateObject ("Scripting.FileSystemObject") Set userFile =
fs.CreateTextFile ("c:\users.csv")

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

ldapStr = "<LDAP://"; & DomainContainer & ">;(&(&(& (mailnickname=*) (|
p/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=SRV3))

Set rs = conn.Execute(ldapStr)

While Not rs.EOF
Set oUser = GetObject (rs.Fields(0).Value) userFile.Write
oUser.displayName & "," & _
   oUser.sAMAccountName & "," & oUser.userprincipalname & ","
      for each email in oUser.proxyAddresses
            userFile.Write email & ","
       userFile.WriteLine ""

However, when I run it, it keep getting a Windows Scripting Host error:
Script:         C:\users.vbs
Line:           13
Char:           1
Error:          One or more errors occurred during processing of command
Code:           80040E14
Source: Provider

Can some one explain what the error is and how to fix?

John Tolmachoff
eServices For You

List Archives:
Exchange Newsletters:
Exchange FAQ:
Other Internet Software Marketing Sites:
World of Windows Networking: Leading
Network Software Directory:
No.1 ISA Server Resource Site: Windows Security
Resource Site: Network Security Library: Windows 2000/NT Fax Solutions:
You are currently subscribed to this Discussion List as:
michael@xxxxxxxxxx To unsubscribe visit

Other related posts: