Get domin netbios name using script
The following vb script shows finding netbios name
1. Assume the domain name is "myrootdns2003.com"
strDomain = "myrootdns2003.com"
' ------ END CONFIGURATION --------
set objRootDSE = GetObject("LDAP://" & strDomain & "/RootDSE")
strADsPath = ";"
strFilter = "(&(objectcategory=Crossref)" & _
"(dnsRoot=" & strDomain & ")(netBIOSName=*));
strAttrs = "netbiosname;"
strScope = "Onelevel"
set objConn = CreateObject("ADODB.Connection")
objConn.Provider = "ADsDSOObject"
objConn.Open "Active Directory Provider"
set objRS = objConn.Execute(strADsPath & strFilter & strAttrs & strScope)
objRS.MoveFirst
WScript.Echo "NetBIOS name for " & strDomain & " is " & objRS.Fields(0).Value
1. Assume the domain name is "myrootdns2003.com"
strDomain = "myrootdns2003.com"
' ------ END CONFIGURATION --------
set objRootDSE = GetObject("LDAP://" & strDomain & "/RootDSE")
strADsPath = "
strFilter = "(&(objectcategory=Crossref)" & _
"(dnsRoot=" & strDomain & ")(netBIOSName=*));
strAttrs = "netbiosname;"
strScope = "Onelevel"
set objConn = CreateObject("ADODB.Connection")
objConn.Provider = "ADsDSOObject"
objConn.Open "Active Directory Provider"
set objRS = objConn.Execute(strADsPath & strFilter & strAttrs & strScope)
objRS.MoveFirst
WScript.Echo "NetBIOS name for " & strDomain & " is " & objRS.Fields(0).Value
0 comments:
Post a Comment