Const $ADS_SCOPE_SUBTREE = 2
$objConnection = ObjCreate("ADODB.Connection")
$objCommand = ObjCreate("ADODB.Command")
$objConnection.Provider = "ADsDSOObject"
$objConnection.Open("Active Directory Provider")
$objCommand.ActiveConnection = $objConnection
$objCommand.CommandText = _
"SELECT distinguishedName FROM " _
& "'LDAP://cn=Configuration,DC=fabrikam,DC=com' " _
& "WHERE objectClass='Computer'"
$objCommand.Properties("Page Size") = 1000
$objCommand.Properties("Timeout") = 30
$objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
$objCommand.Properties("Cache Results") = False
$objRecordSet = $objCommand.Execute
$objRecordSet.MoveFirst
Do
ConsoleWrite( "Computer Name: " & $objRecordSet.Fields("distinguishedName").Value & @CRLF)
objRecordSet.MoveNext
Until objRecordSet.EOF
当程序执行到
$objCommand.ActiveConnection = $objConnection
就出错,我把其它全部注释掉
想问大家一句,遇到这种情况,应该如何解决?
[ 本帖最后由 fjchenq 于 2009-4-8 11:45 编辑 ] |