Is NetBIOS over TCP/IP Enabled?


As anyone who has typed ‘ipconfig /all’ knows, Windows has a lot of pesudo- and otherwise irrelevant network adapters that exist only as ‘logcal entities’.  The clause ‘where IPEnabled=’true'” will separate out the true TCP/IP adapters, but in some cases even they are but building blocks, such as HP’s Team adapter.  So, we can have a server with multiple adapters, and we want to know which one has NetBIOS over TCP/IP enabled, if any.

$wmi = Get-WmiObject -computerName $myComputer -query “select * from win32_networkadapterconfiguration where IPEnabled=’true'”;
$interface = $null;
$wmi | % { if ($_.TcpIpNetBiosOptions) { $interface = $_; break; }}
[bool]$interface;

 


Comments (2)

  1. Griffintard says:

    This format is a bit cleaner.

    Function Get-Netbios {

    $EnabledNics= @(gwmi -query "select * from win32_networkadapterconfiguration where IPEnabled='true'")

    $OutputObj = @()

    foreach ($Network in $EnabledNics) {

    If($network.tcpipnetbiosoptions) {

    $netbiosEnabled = [bool]$network

    }

    $nic = gwmi win32_networkadapter | where {$_.index -match $network.index}

    $OutputObj  += @{

    Nic = $nic.netconnectionid

    NetBiosEnabled = $netbiosEnabled

    }

    #$OutputObj #| % { new-object PSObject -Property $_} | ft -auto

    }

    $out = $OutputObj | % { new-object PSObject -Property $_} | select Nic, NetBiosEnabled| ft -auto

    $out

    }

  2. timdunn says:

    Absolutely!  I'd leave out the FT -Auto myself, nut it's much clearer and cleaner than my chicken scratching.  Thanks!