Dim $oRootDSE, $sDomainADsPath, $oCon, $oRecordSet, $oCmd, $sGroup, $sProperties, $aDescription, $aMember, $iCount
$oRootDSE = GetObject("LDAP://RootDSE")
$sDomainADsPath = "LDAP://" & $oRootDSE.Get("defaultNamingContext")
$oCon = CreateObject("ADODB.Connection")
$oRecordSet = CreateObject("ADODB.Recordset")
$oCmd = CreateObject("ADODB.Command")
;$oRootDSE = Nothing
$oCon.Provider = "ADsDSOObject"
$oCon.Open("ADProvider")
$oCmd.ActiveConnection = $oCon
$sProperties = "ADsPath,description"
$sGroup = "*"
$oCmd.CommandText = "<"+$sDomainADsPath+">;(+(objectClass=computer)(cn="+@WKSTA+"));"+$sProperties+";subtree"
$oRecordSet = $oCmd.Execute
;$oRecordSet.MoveFirst
While Not $oRecordSet.EOF ;fails right here
$icount = $oRecordSet.Fields("ADsPath").Value
End While
Dim $oRootDSE, $sDomainADsPath, $ldapPath, $filter, $entry, $searcher, $result, $DirectoryServices, $objParent
$oRootDSE = GetObject("LDAP://RootDSE")
$sDomainADsPath = "LDAP://" + $oRootDSE.Get("defaultNamingContext")
$ldapPath = $sDomainADsPath
$filter = String.Format("(+(objectCategory=computer)(name="+ @WKSTA +"))")
$objParent = GetObject("$icount")
$objParent.Put("description", "@fullname")
$objParent.SetInfo
$oRecordSet.Close
$oCon.Close
$oRecordSet = Nothing
$oCon = Nothing