Select distinguishedName, cn, mail, sAMAccountName, userPrincipalName, telephoneNumber, department, userAccountControl, objectClass From 'LDAP://DC=CrystalReports, DC=com' Where ObjectClass='User'
Above retrieves the following fields: distinguishedName, cn, mail, sAMAccountName, userPrincipalName, telephoneNumber, department, userAccountControl, objectClass FROM the domain CrystalReports.com WHERE The ObjectClass Is USER.
Tools to use to figure out field names etc. is: AdisEdit (Adsiedit.msc). This tool is a part of the support tools for windows 2000 or 2003 server. Also Schema Management (SchmMgmt.msc) might be of interest. Be careful with this tool it can be very destructive if you start modifying. To use this tool the following dll is to be registered: schmmgmt.dll. This is done in the following way: Regsvr32 %systemroot%\system32\schmmgmt.dll To use the Schema Management tool the adminpak.msi is required to be installed on the computer you are using it.
On windows 2000 professional use the adminpak.msi from windows 2000 server editions. On wWindows XP use the Adminpak.msi from windows 2003 server editions.