Configure WINS NetBIOS parameters (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 the following three optional WINS parameters:
'  [1] Enable DNS as a backup for WINS name resolution
'  [2] Enable lookup from a central LMHOSTS file
'  [3] Configure the local computer with a NetBIOS Scope ID of "FINANCE"
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
EnableDNS = True
EnableLMHosts = True
LMHOSTSFile = "\\server1\admin\lmhosts"
ScopeID = "WORKGROUP" ' set this to the name of your NetBIOS Scope
' ------ END CONFIGURATION ---------

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

Set nicConfig = objWMIService.Get("Win32_NetworkAdapterConfiguration")

EnableWINS = nicConfig.EnableWINS(EnableDNS, EnableLMHosts, _
  LMHOSTSFile, ScopeID)
If EnableWINS = 0 Then
  WScript.Echo "Set WINS options successfully!"
ElseIf intEnableWINS = 1 Then
  WScript.Echo "Set WINS options successfully! Please reboot."
Else
  WScript.Echo "Error! Unable to set WINS options."
End If

This code has been viewed 1992 times.

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