Using REG.EXE, built into Windows XP, Windows Server 2003, and later operating systems, or installed from the Windows 2000 Support Tools, and InterfaceGUID.bat, I have scripted EnableNBT.bat to retrieve or set the NetBIOS over TCP/IP setting for an interface.

The syntax for using EnableNBT.bat is:

EnableNBT Name Action Setting

Where:

Name    is the name of the Local Area Connection.                              Action  is an R to retrieve the NetBIOS over TCP/IP setting, or a W to write it.                              Setting is the name of a variable that will contain the NetbiosOptions if Action is an R or                                      if Action  is a W, the name of the variable that contains:                                              1 - NetBT is to be enabled on the interface, or                                             2 - NetBT is to be disabled on the interface.
EnableNBT.bat contains:
@echo off                              setlocal                              if \{%3\}==\{\} goto err                              set Name=%1                              set Action=%2                              set NbtO=0xN                              set GUID=none                              set key=HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\Tcpip                              call InterfaceGUID %Name% GUID                              if "%GUID%" EQU "none" goto err                              set key="%key%_%GUID%"                              if /i "%Action%" EQU "R" goto Read                              if /i "%Action%" EQU "W" goto Write                              :err                              @echo Syntax EnableNBT Name Action Setting                              endlocal                              goto :EOF                              :Read                              for /f "Tokens=3" %%n in ('reg query %key% /v NetbiosOptions') do (                               set NbtO=%%n                              )                              set NbtO=%NbtO:~2,1%                              endlocal&set %3=%NbtO%                              goto :EOF                              :Write                              call set NbtO=%%%3%%                              call :quiet>nul 2>&1                              if ERRORLEVEL 0 goto finish                              @echo EnableNBT was unable to update NetbiosOptions - %key%                              :finish                              endlocal                              goto :EOF                              :quiet                              reg add %key% /v NetbiosOptions /t REG_DWORD /d %NbtO% /f