2013年6月12日 星期三

list trusted domain info

Dim objConnection, objRootDSE, objRecordSet
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

沒有留言: