Loading...
 

Greg`s Tech blog

Printing Exchange Distribution List Members

Thursday 15 of May, 2003
HOWTO Print Exchange 5.5 Distribution List Members

We had a need recently to print the contents of an Exchange 5.5 distribution list. We've looked in thre past for a tool to do this and never had any luck.
I found a python script that did this and since I don't know python(yet), I converted it to vbscript. Run the script (cscript getmembers.vbs) to see the Usage.
You'll need ADO & ADSI installed locally. E-mail with questions/bugs. Let me know if it works for Exch2k

I hope you'll find this of value. (save as getmembers.vbs)

'getmembers.vbs - Greg Martin - CSC May 2003
'Notes:
'If you use this regularly, you can define sUser & sPwd with a user from your local site
'Run with cscript to prevent a gazillion pop up windows
'
'
'
dim oIADs
dim MyContainer
dim objRecipients
dim item

CRLF = Chr(13) & Chr(10)


sUsage =    "Getmembers.vbs - Greg Martin, CSC  2003" & CRLF & CRLF
sUsage = sUsage & "Returns the entries of an Exchange distribution list and nested lists" & CRLF
sUsage = sUsage & "Usage:  cscript getmembers.vbs      " & CRLF & CRLF
sUsage = sUsage & "Where:" & CRLF  
sUsage = sUsage & "Servername is the name of an exchange server" & CRLF  & CRLF
sUsage = sUsage & "Listname is the alias of the list to be enumerated" & CRLF   & CRLF
sUsage = sUsage & "UserDN is the DN of an exchange user(used to login via LDAP)" & CRLF 
sUsage = sUsage & "Note: User DN typically looks like 'cn=alias, ou=site, o=org'" & CRLF
sUsage = sUsage & "      Specifying the recipients container is not necessary and does not work" & CRLF &CRLF
sUsage = sUsage & "Password is the password for user" & CRLF  & CRLF
sUsage = sUsage & "1 Recurses list members. 0 does not recurse (optional - must be supplied if CN|UID id specified) " & CRLF  & CRLF
sUsage = sUsage & "CN prints Exch CN of list member; UID prints Exch alias (optional)" & CRLF & CRLF
sUsage = sUsage & "Example: cscript getmembers.vbs Rosnt47 " & chr(34) & "cn=tcs_users,cn=Distribution_
Lists,ou=ets,o=ets" & chr(34) & " " & chr(34) & "cn=juser, ou=ETS, o=ETS" & chr(34) & " p@ssw0rd 1 CN" & CRLF & CRLF

'Todo
Set oArgs = WScript.Arguments