Hello Guys,
I am trying to create a vb script that will modify my WINS server settings.
My script is working fine, however, I want to know how can I narrow down this..
I wanted to modify NIC with specific WINS address only.
For Example: Change WINS of NIC with 10.54.14.10, 10.54.14.11 and 10.54.14.12 only, change it to 11.54.25.10
How can i specifically query or choose that specific NIC.
Thanks for your help!.
I have "serverlist.txt" that hold the computers that I will change.
strPrimaryServer = "110.170.1.20"
strSecondaryServer = "110.111.1.53"
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objTsL = objFso.OpenTextFile(strListPath & "serverlist.txt",1)
Do Until objTsL.AtEndOfStream
strComputer = objTsL.ReadLine
Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colActiveNic = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
WScript.Echo VbCrLf & "Server: " & strComputer
' Log current WINS server settings
For Each objItem In colActiveNic
WScript.Echo " WINS Server Search Order - Before:"
WScript.Echo " Primary Server:" & objItem.WINSPrimaryServer
WScript.Echo " Secondary Server:" & objItem.WINSSecondaryServer
' Replace WINS server settings
SetWins = objItem.SetWINSServer(strPrimaryServer, strSecondaryServer)
If SetWins = 0 Then
WScript.Echo VbCrLf & "WINS server updated successfully."
Else
WScript.Echo VbCrLf & "Unable to replace WINS server."
End If
Next
WScript.Echo VbCrLf & String(80, "-")
Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objItem in colItems
Wscript.Echo " Updated WINS Server Information"
WScript.Echo " Primary Server:" & objItem.WINSPrimaryServer
WScript.Echo " Secondary Server:" & objItem.WINSSecondaryServer
Next
Loop