WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get List of all Exchange Aliases from Active Directory

 Keywords:  Exchange Aliases Active Directory 

Question:

I'm trying to get a list of all Exchange aliases from Active Directory. Is there such a function?

Answer:

I am sure there are better ways to do this but this example should get you started.
; Get a list of all users.
sSearchPoint =  "LDAP://myexserver"      
sSearch      = "(&(objectCategory=user)(objectClass=user))"
lResult = dsFindPath(sSearchPoint, sSearch)

lAliases = ""
nCount   = ItemCount(lResult, @tab)
for i = 1 to nCount
 
   sUser = ItemExtract( i, lResult, @Tab)

   ;  Get the alias - its stored in the mailNicName property.
   sAlias = dsGetProperty(sUser, "mailNickName")
   if strlen(sAlias)
      lAliases = ItemInsert(sAlias, -1, lAliases, @lf)
   endif
next

; Display the result
message("Search Result",  lAliases)

Article ID:   W15386
File Created: 2003:05:13:11:27:26
Last Updated: 2003:05:13:11:27:26