Share via


Windows Server: Disable LMHOSTS with PowerShell

With PowerShell you can pretty much do anything. In this article we disabled Netbios using a registry key, however you can do the same using WMI and PowerShell as well as removing the tick box for Lmhosts on a Network Card.

To do this, you can run the following set of commands:

$NICS = Get-WmiObject win32_NetworkAdapterConfiguration
foreach ($NIC in $NICS){
$NIC.settcpipnetbios(2) # 2 = disable netbios on interface
}
$nicClass = Get-WmiObject -list Win32_NetworkAdapterConfiguration
$nicClass.enablewins($false,$false)

https://everything-powershell.com/wp-content/uploads/2020/01/image.png

The first part does netbios and the second part does lmhosts.