I came across a situation last week where I needed to finally disable NetBIOS over TCP/IP. While looking for a way to disable it, unfortunately, I found that there really isn’t a good clean way to do so using Group Policy. At least, if there was a good way, I couldn’t find it.

What I came up with was a VBScript that disables NetBIOS over TCP/IP for every NIC in a computer. The script can be easily modified to enable NetBIOS over TCP/IP as well. I’m currently using this as a Computer Startup Script. Once the script is run, the effects should take place on the next reboot.

A screenshot of the settings the script modifies.

The screenshot above shows you the settings we’re modifying. Use this as a reference so you know which line to uncomment in the script. By default I have the script set to 2 - Disable NetBIOS over TCP/IP.

'  Title:      Configure NetBIOS over TCP/IP
'   Date:      2/25/2013
' Author:      Gregory Strike
'    URL:      http://www.gregorystrike.com/2013/02/25/configure-netbios-over-tcpip-group-policy.html
'Purpose:      The following script will itterate through all NICs on a computer
'              to configuure NetBIOS over TCP/IP.  It finds the NICs listed under:
'              HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces
'              For each NIC under the key, it sets the NetbiosOptions value to one
'              of the below.  (Be sure to uncomment the setting you desire.)
'              0 - Default: Use DHCP setting from the DHCP Server
'              1 - Enable NetBIOS over TCP/IP
'              2 - Disable NetBIOS over TCP/IP
'Requirements: Administrative Privileges
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set ObjWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'Set the path to the Network Interfaces
strKeyPath = "SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces"
'Get all the known interfaces
ObjWMI.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
'If there was a problem getting strKeyPath, exit the script before throwing an error.
If IsNull(arrSubKeys) Then WScript.Quit
WScript.Echo Now() & " - Searching for Network Adapaters."
'Loop through all Network Interface Cards and disable NetBIOS over TCP/IP
For Each Adapter In arrSubKeys
	WScript.Echo Now() & " - Disabling NetBIOS over TCP/IP on '" & Adapter & "'"
	'Default: Use DHCP setting from the DHCP Server
	'objWMI.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & Adapter, "NetbiosOptions", 0
	'Enable NetBIOS over TCP/IP
	'objWMI.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & Adapter, "NetbiosOptions", 1
	'Disable NetBIOS over TCP/IP
	objWMI.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & Adapter, "NetbiosOptions", 2
WScript.Echo Now() & " - Completed."


Gregory Strike

Husband, father, IT dude & blogger wrapped up into one good looking package.