Type the following code into Notepad (with Word Wrap disabled) and
save it with a .vbs extension as
ChangeWINS.vbs:
Option Explicit
On Error Resume Next
Dim objLocator, objService, NIC
Dim strComputer, strUsername, strPassword
Dim strWINS1, strWINS2
Dim intErr
strComputer = "."
strUsername = ""
strPassword = ""
strWINS1 = "172.16.1.122"
strWINS2 = "172.16.1.132"
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objService = objLocator.ConnectServer(strComputer, "root/cimv2", & strUsername,
strPassword)
objService.Security_.impersonationlevel = 3
For Each NIC In objService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration
Where IPEnabled=True")
WScript.Echo "Nic Index: " & NIC.index
WScript.Echo "Current Settings"
WScript.Echo "Primary Wins Server: " & NIC.WINSPrimaryServer
WScript.Echo "Secondary Wins Server: " & NIC.WINSSecondaryServer
intErr = NIC.SetWinsServer(strWINS1, strWINS2)
If intErr <> 0 Then Wscript.Echo "Error changing WINS"
Next
Set objService = Nothing
Set objLocator = Nothing