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:

<b>Name</b>    is the name of the Local Area Connection.

<b>Action</b>  is an <b>R</b> to retrieve the <b>NetBIOS over TCP/IP</b> setting, or a <b>W</b> to write it.

<b>Setting</b> is the name of a variable that will contain the <b>NetbiosOptions</b> if <b>Action</b> is an <b>R</b> or
        if <b>Action</b>  is a <b>W</b>, the name of the variable that contains:
               <b>1</b> - <b>NetBT</b> is to be enabled on the interface, or
               <b>2</b> - <b>NetBT</b> 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