Disabling NetBIOS over TCP/IP Via Registry
So, if anyone out there is trying to get rid of NetBIOS to reduce broadcast traffic and optimize their network, I'm putting together a short guide on how to disable NetBIOS via the registry, should you need to perform this operation on a large number of computers. Since manually visiting each computer requires too much work, we'll look at the registry value we need to change using a script to disable NetBIOS.
The registry value we need to change resides in the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NetBT\Parameters\Interfaces\Tcpip_
\ key, and the value's name is NetBIOSOptions. There are three valid values for this value:
0x0: Use NetBIOS setting from DHCP server or Enable if static IP is used
0x1: Enable NetBIOS over TCP/IP
0x2: Disable NetBIOS over TCP/IP
As you can probably tell, we want to use the last option, 0x2 as the correct value to disable NetBIOS. Let's look at how we can use WMI to access the registry of a computer remotely and change this value for us.
strComputer = "."
HKLM = 2147483650
valuename = "NetBIOSOptions"
subkey = "System\CurrentControlSet\Services\NetBT\Parameters\Interfaces\"
'Get registry provider from WMI
set registry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
'Get subkeys of Interfaces key ... these will be random GUIDs, so we need to grab them dynamically
registry.EnumKey HKLM, subkey, subkeys
for i = 0 to ubound(subkeys)
'Set hex value of registry value to 0x2. We have to use the built-in VBscript hex function to convert from decimal to hex data type
registry.SetDWORDValue HKLM, subkey & subkeys(i), valuename, hex(2)
next