Hi,
just a short post :-). A powershell script to get the NetBIOS Name of an Active Directory Domain
############################################################################### # Gets the NetBIOS Domain # Author Michael Albert michlstechblog.info # License: GPL v2 ############################################################################### [reflection.assembly]::LoadWithPartialName("System.DirectoryServices.Protocols")|Out-Null if($args.count -ne 1){ Write-Warning " Start script with fqdn as parameter" Write-Warning (" for example: "+$myInvocation.myCommand.name+" yourdomain.com") exit 1 } $sDomainName=$args[0] # Get AD Root $oRootDSE = [ADSI]"LDAP://RootDSE" $sConfig = $oRootDSE.Get("configurationNamingContext") # AD Object AD Root $oADSearchRoot=New-object System.DirectoryServices.DirectoryEntry("LDAP://CN=Partitions," + $sConfig) # Search for Netbiosname of the specified domain $sSearchString="(&(objectclass=Crossref)(dnsRoot="+$sDomainName+")(netBIOSName=*))" $oSearch=New-Object directoryservices.DirectorySearcher($oADSearchRoot,$sSearchString) $sNetBIOSName=($oSearch.FindOne()).Properties["netbiosname"] # Print out Write-Host "Domain NetBIOS Name:" $sNetBIOSName
Have fun :-)!
Michael