Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: List Enumerate User Accounts Users ADSI Active Directory AD
; Get a list of users ; Write out user properties to a .csv file AddExtender("wwads44i.dll") ServerDn=dsGetProperty("LDAP://rootDSE", "serverName") ServerName=ItemExtract(1, ServerDn, ",") ServerName=ItemExtract(2, ServerName, "=") ServerDn=dsGetProperty("LDAP://rootDSE", "defaultNamingContext") ServerPath="LDAP://" : ServerName : "/" : ServerDN handle = FileOpen("c:\ADSI.csv","WRITE") users_in_OU = dsFindPath( ServerPath, "(&(objectcategory=Person)(objectclass=user))" ) count = ItemCount( users_in_OU, @TAB ) For xx = 1 To count ; User container object's path UserPath = ItemExtract( xx, users_in_OU, @TAB ) ; Get properties. sDisplayName = dsGetProperty( UserPath, "cn" ) sFirstName = dsGetProperty( UserPath, "givenName" ) sLastName = dsGetProperty( UserPath, "sn" ) sAlias = dsGetProperty( UserPath, "uid" ) sSMTPAddr = dsGetProperty( UserPath, "mail" ) FileWrite( handle, sDisplayName : "," : sFirstName : "," :sLastName : "," : sAlias : "," : sSMTPAddr ) Next FileClose(handle) Run("c:\ADSI.csv", "")) Exit
Article ID: W17551
Filename: List Users.txt
File Created: 2008:07:17:08:44:22
Last Updated: 2008:07:17:08:44:22