I have an ethernet adapter and a wireless adapter and can't for the life of me figure out the command line (or powershell) used to disable Netbios over TCP/IP for all the adapters on a system. I would appreciate any input on this.
According to Andre Viot's blog:
$adapters=(gwmi win32_networkadapterconfiguration )
Foreach ($adapter in $adapters){
Write-Host $adapter
$adapter.settcpipnetbios(0)
}
Note that you may need to press enter two times after pasting above, which confirms you're done commanding.
Should disable Netbios on EVERY adapter. You might wish to be more discerning, and be sure you're disabling Netbios on the right interface, however, so I would first, to see a list of your adapters which are currently connected, run:
Get-WmiObject Win32_NetworkAdapterConfiguration | Where IPAddress
Or for older PowerShell:
Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress -ne $null }
ServiceName DHCPEnabled Index Description
----------- ----------- ----- -----------
VMSMP True 14 Intel Wireless Adapter
VMSMP True 29 Intel Ethernet Adapter
Select the one you want to disable using a filter provided to Where Object, like this. I want to turn off NetBios on my LAN.
$adapter = Get-WmiObject Win32_NetworkAdapterConfiguration | Where Description -like "*Ethernet*"
$adapter.SetTcpIPNetbios(0) | Select ReturnValue
ReturnValue
-----------
0
There are a number of possible return codes though, like a WHOLE lot. Make sure to check the list here, and do not lazily assume that the function will work on every device. You should definitely test this first and understand the ramifications.
http://www.alexandreviot.net/2014/10/09/powershell-disable-netbios-interface/