Give fnLDAPQuery() a try. Here is an example for the current workstation...

Code:

; == Return the distinguishedName for the computer ===================
$aAttributes = "distinguishedName"
$sADsPath = "LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")
$strFilter = "(&(objectClass=Computer)(Name="+@WKSTA+"))"

$aResults = fnLDAPQuery($aAttributes,$sADsPath,$strFilter)
@ERROR " | " @SERROR ?

For Each $Result in $aResults
$Result ?
Next