Dim strFilter
strFilter = "(NETBIOSName=*)"
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objRootDSE = GetObject("LDAP://RootDSE")
Wscript.Echo objRootDSE.Get("configurationNamingContext")
Set objRecordSet = objConnection.Execute( _
"
strFilter & ";" & "NETBIOSName,dnsroot,ncname;subtree")
Set objRootDSE = Nothing
While Not objRecordSet.EOF
WScript.Echo "NETBIOSName:" & objRecordSet.Fields("netbiosname").Value & vbTab _
& "DNSRoot:" & join(objRecordSet.Fields("dnsroot").Value) & vbTab _
& "CName:" & objRecordSet.Fields("ncname").Value
objRecordSet.MoveNext
WEnd
沒有留言:
張貼留言