JSI Tip 8271 How can I retrieve, or set, the NetBIOS over TCP/IP setting for an interface?

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


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
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
@echo Syntax EnableNBT Name Action Setting
goto :EOF
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
call set NbtO=%%%3%%
call :quiet>nul 2>&1
if ERRORLEVEL 0 goto finish
@echo EnableNBT was unable to update NetbiosOptions - %key%
goto :EOF
reg add %key% /v NetbiosOptions /t REG_DWORD /d %NbtO% /f

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.