Making list of e-mail addresses

  • From: "John Tolmachoff \(Lists\)" <johnlist@xxxxxxxxxxxxxxxxxxx>
  • To: "'[ExchangeList]'" <exchangelist@xxxxxxxxxxxxx>
  • Date: Thu, 24 Jun 2004 11:24:55 -0700

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

I followed the article
http://www.msexchange.org/tutorials/Creating_a_list_of_Users_and_their_email
_addresses_in_Exchange_2000_2.html

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 = "ADSDSOObject"
conn.Open "ADs Provider"

ldapStr = "<LDAP://"; & DomainContainer & ">;(&(&(& (mailnickname=*) (|
(&(objectCategory=person)(objectClass=user)(msExchHomeServerName=/o=QuestCom
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 & ","
       next
       userFile.WriteLine ""
      rs.MoveNext
Wend
______________________________________________________

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
Engineer/Consultant/Owner
eServices For You




Other related posts: