Disable NetBIOS with PowerShell

1. NetBIOS and Direct Hosting

With direct hosting, NetBIOS is not used for name resolution. DNS is used for name resolution and the Microsoft networking communication is sent directly over TCP without a NetBIOS header. Direct hosting over TCP/IP uses TCP port 445 instead of the NetBIOS session TCP port 139.

By default, both NetBIOS and direct hosting are enabled, and both are tried in parallel when a new connection is established. The first to succeed in connecting is used for any given attempt.

NetBIOS over TCP/IP support can be disabled to force all traffic to use TCP/IP direct hosting.

.

.

2. Disabling NetBIOS

To disable NetBIOS over TCP/IP:

  • Go to Control Panel / Network and Internet / Network and Sharing Center
  • Then select “Change adapter settings
  • Right-click / Properties on the Connection which needs to have NetBIOS deactivated:

Double-click “Internet Protocol Version 4 (TCP-IPv4)

.

Click “Advanced

.

Select “Disable NetBIOS over TCP/IP

.

.

3. PowerShell

Disabling NetBIOS over TCP/IP can be done through the registry:

  • Go to HKLM:SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces
  • For each connection, then set NetbiosOptions = 2

.

This can be done with PowerShell with the following script :