Using standard commands, I have scripted NetBiosDomain.bat to return the NetBIOS domain name.

The syntax for using NetBiosDomain.bat is:

\[Call\} NetBiosDomain DomainName

Where DomainName is a call directed environment variable that will contain the the NetBIOS domain name, or the computer name if the computer is not logged onto a domain, or NONE if there is an error.

NetBiosDomain.bat contains:

                              @echo off                              if \{%1\}==\{\} @echo Syntax: NetBiosDomain DomainName&goto :EOF                              if exist "%TEMP%\NetBiosDomain.vbs" goto doit                              @echo dim WshNetwork, strDomainName>"%TEMP%\NetBiosDomain.vbs"                              @echo Set WshNetwork = WScript.CreateObject("WScript.Network")>>"%TEMP%\NetBiosDomain.vbs"                              @echo strDomainName = WshNetwork.UserDomain>>"%TEMP%\NetBiosDomain.vbs"                              @echo Wscript.Echo WshNetwork.UserDomain>>"%TEMP%\NetBiosDomain.vbs"                              :doit                              SET %1=NONE                              FOR /F "TOKENS=*" %%D in ('cscript //nologo "%TEMP%\NetBiosDomain.vbs"') do (                               SET %1=%%D                              )