An example.

 Code:
Break on

$aAttributes = "Name","Department"
$sADsPath = "LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")  
$strFilter = "(&(objectCategory=person)(objectClass=user)(displayName=" + @FULLNAME + "))"

$aResults = fnLDAPQuery($aAttributes,$sADsPath,$strFilter,"Name")  

For $r = 0 to Ubound($aResults)
	;$aResults[$r,0] = Fullname
	;$aResults[$r,1] = Department
	?"User: " $aResults[$r,0]
	?"Has printer: " $aResults[$r,1] " in the department field in AD."
	Sleep 5	
Next


You need to include the fnLDAPQuery() - Uses ADO to query Active Directory using LDAP dialect UDF in this code or you could call it instead of including it.
See: KiXtart FAQ & How to's » How to use UDFs if you are wondering how to do that.


Edited by Mart (2007-07-10 09:22 AM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.