Copy and paste this to a VBS file and run it.
You'll find the file you want as a CSV file on your C: drive.


'ExchangeUsers.VBS


Dim rootDSE, domainObject
Set rootDSE=GetObject("LDAP://RootDSE";)
domainContainer = rootDSE.Get("defaultNamingContext")
Set domainObject = GetObject("LDAP://"; & domainContainer)
Set fs = CreateObject ("Scripting.FileSystemObject")
Set userFile = fs.CreateTextFile ("c:\users.csv")
ExportUsers(domainObject)
Set oDomain = Nothing
MsgBox "Finished"
WScript.Quit
 
Sub ExportUsers(oObject)
Dim oUser
For Each oUser in oObject
Select Case oUser.Class
        Case "user"
        If oUser.mail <> "" then
          userFile.Write "," & oUser.displayName & "," &
oUser.sAMAccountName & "," & oUser.userprincipalname & ","
          for each email in oUser.proxyAddresses  
            userFile.Write email & ","
          next 
          userFile.WriteLine ""
        End if  
        Case "organizationalUnit" , "container"
        If UsersinOU (oUser) then 
          ExportUsers(oUser)
        End if 
End select
Next
End Sub

Function UsersinOU (oObject)
Dim oUser
UsersinOU = False
for Each oUser in oObject 
Select Case oUser.Class
         Case "organizationalUnit" , "container"
           UsersinOU = UsersinOU(oUser)
         Case "user"
           UsersinOU = True
         
End select
Next
End Function


Amit Zinman
Project Manager and Systems Consultant
Professional Services Group
Getronics (Israel)
Tel: +972-3-5127306
Mobile: +972-53-570139
Email: [EMAIL PROTECTED]


-----Original Message-----
From: Cook, David A. [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, December 06, 2001 8:37 PM
To: Exchange Discussions
Subject: Export GAL

Exchange 2000 SP1

How can I export the GAL? All I really need is to be able to export a
list of users and their smtp addresses.

This is probably simple but I can not find anything on how to do this.
Probably a matter of searching on the wrong information.

Dave Cook
Exchange Administrator
Kutak Rock, LLP
402-231-8352
[EMAIL PROTECTED]

######################################################################
The information contained in this electronic mail transmission
(including any accompanying attachments) is intended solely for its
authorized recipient(s), and may be confidential and/or legally 
privileged.  If you are not an intended recipient, or responsible
for delivering some or all of this transmission to an intended 
recipient, you have received this transmission in error and are 
hereby notified that you are strictly prohibited from reading, copying,
printing, distributing or disclosing any of the information contained
in it.  In that event, please contact us immediately by telephone 
(402)346-6000 or by electronic mail at [EMAIL PROTECTED] and
delete the original and all copies of this transmission (including any
attachments) without reading or saving in any manner.  

Thank you.
######################################################################

_________________________________________________________________
List posting FAQ:       http://www.swinc.com/resource/exch_faq.htm
Archives:               http://www.swynk.com/sitesearch/search.asp
To unsubscribe:         mailto:[EMAIL PROTECTED]
Exchange List admin:    [EMAIL PROTECTED]

_________________________________________________________________
List posting FAQ:       http://www.swinc.com/resource/exch_faq.htm
Archives:               http://www.swynk.com/sitesearch/search.asp
To unsubscribe:         mailto:[EMAIL PROTECTED]
Exchange List admin:    [EMAIL PROTECTED]

Reply via email to