I have a script in VBScript that automates the WINS entries (1 Primary and 1 secondary) but has a problem when I try to add more than "1" Secondary WINS entries. Attached is the script and any help will be much appreciated (panjwana@exchange.ml.com).


_________________________________________________________________________

On Error Resume Next

strComputer = "."
strWINSPrimaryServer = "146.125.87.65"
strWINSSecondaryServer = "146.125.40.65"

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

WScript.Echo VbCrLf & "Host Name: " & strComputer & VbCrLf & _
" Attempting to set WINS primary and secondary servers ..."

For Each objNicConfig In colNicConfigs
WScript.Echo VbCrLf & _
" Network Adapter " & objNicConfig.Index & VbCrLf & _
" " & objNicConfig.Description
intSetWINSServer = objNicConfig.SetWINSServer(strWINSPrimaryServer, _
strWINSSecondaryServer)
If intSetWINSServer = 0 Then
WScript.Echo " Successfully set WINS servers."
ElseIf intSetWINSServer = 1 Then
WScript.Echo " Successfully set WINS servers." & _
VbCrLf & " Must reboot."
Else
WScript.Echo " Unable to set WINS servers."
End If
Next

WScript.Echo VbCrLf & String(80, "-")

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

For Each objNicConfig In colNicConfigs
WScript.Echo VbCrLf & _
" Network Adapter " & objNicConfig.Index & VbCrLf & _
" " & objNicConfig.Description
WScript.Echo " Primary WINS Server: " & objNicConfig.WINSPrimaryServer
WScript.Echo " Secondary WINS Server: " & _
objNicConfig.WINSSecondaryServer
Next

____________________________________________________________________________

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...

Re: Multiple Secondary WINS Entries by Torgeir

Torgeir
Thu Jan 06 12:38:58 CST 2005

panjwana@exchange.ml.com wrote:

> I have a script in VBScript that automates the WINS entries
> (1 Primary and 1 secondary) but has a problem when I try to add
> more than "1" Secondary WINS entries. Attached is the script and
> any help will be much appreciated
Hi

I'm not so sure that this is supported by the SetWINSServer method.

You should be able to use the command line utility netsh.exe to modify
the Wins Address to your liking.

Command line: "netsh.exe interface ip set wins"


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

RE: Multiple Secondary WINS Entries by GiaDzich

GiaDzich
Mon Mar 21 17:25:02 CST 2005

Can anyone specifically show how to code "netsh" in VBScript?

Thank