Configure NetBIOS over TCP (VBScript)

This code can be found in Chapter 1 of Windows Server 2003 Networking Recipes

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' From the book "Windows Server 2003 Networking Recipes"

' This code enables NetBIOS over TCP/IP
' ------ SCRIPT CONFIGURATION ------
strComputer = "."

Const DEFAULT = 0
Const ENABLED = 1
Const DISABLED = 2
' ------ END CONFIGURATION ---------

Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set nics = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

For Each nic in nics
  intNetBT = nic.SetTCPIPNetBIOS(ENABLED)
  If intNetBT = 0 Then
    WScript.Echo "Success! NetBIOS over TCP/IP enabled!"
  ElseIf intNetBT = 1 Then
    WScript.Echo "Success! NetBIOS over TCP/IP enabled, please reboot."
  Else
    WScript.Echo "Error! Unable to enable NetBIOS over TCP/IP."
  End If
Next

This code has been viewed 1562 times.

New from the creators of TechTasks.com: StatSheet.com