2.7. Finding the NetBIOS Name of a Domain

Problem

You want to find the NetBIOS name of a domain. Although Microsoft has moved to using DNS for primary name resolution, the NetBIOS name of a domain is still important, especially with down-level clients that are still based on NetBIOS instead of DNS for naming.

Solution

Using a graphical user interface

  1. Open the Active Directory Domains and Trusts snap-in.

  2. Right-click the domain you want to view in the left pane and select Properties.

The NetBIOS name will be shown in the “Domain name (pre-Windows 2000)” field.

Using a command-line interface

> dsquery * cn=partitions,cn=configuration,<ForestRootDN> -filter[RETURN] 
"(&(objectcategory=crossref)(dnsroot=<DomainDNSName>)(netbiosname=*))" -attr[RETURN] 
netbiosname

Using VBScript

' This code prints the NetBIOS name for the specified domain
' ------ SCRIPT CONFIGURATION ------
strDomain = "<DomainDNSName>" ' e.g. amer.rallencorp.com ' ------ END CONFIGURATION --------- set objRootDSE = GetObject("LDAP://" & strDomain & "/RootDSE") strADsPath = "<LDAP://" & strDomain & "/cn=Partitions," & _ objRootDSE.Get("configurationNamingContext") & ">;" 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 ...

Get Active Directory Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.