Shorty
(Just in Town)
2009-12-09 12:49 PM
Extract the Description from AD of whole OU

Hi,

Is it possible to extract the Description from all users in AD that are in a specific OU.
I tried it with fnLDAPQuery(), but receive the following message
"ERROR: Error in expression: this type of array not supported in expressions.!"

I use the following code
 Code:
 $aAttributes = "Name", "description"  
 $sADsPath = "LDAP://OU=user OU,OU=location OU,DC=domain,DC=com"  
 $strFilter = "(&(objectClass=User)(Name=*))"  
  
 $aResults = fnLDAPQuery($aAttributes,$sADsPath,$strFilter,"Name")  
 @ERROR " | " @SERROR ?  
  
 For $c = 0 to Ubound($aResults) 
     For $r = 0 to Ubound($aResults,2) 
         $aResults[$c,$r] ? 
     Next 
     ? 
 Next

Am I doing something wrong? Can it be done with fnLDAPQuery() and how?


Glenn BarnasAdministrator
(KiX Supporter)
2009-12-09 04:40 PM
Re: Extract the Description from AD of whole OU

Change this line
 Code:
         $aResults[$c,$r] ? 
to
 Code:
         VarTypeName($aResults[$c,$r]) ? 
and see if that provides a clue to the error message! I'll bet that the array element itself contains an array.. you'll need to determine that and enumerate that list. It's in the LDAPQuery UDF examples.

Glenn


Shorty
(Just in Town)
2009-12-10 01:13 PM
Re: Extract the Description from AD of whole OU

Great problem solved.
Thanks