mojo_4664
asked on
Using VBScript to Add More Than Two WINS Servers
Okay, pretty straightforward question here:
When manually adding WINS server entries to any given network connection, you can add as many as you want. However, when using VBScript the SetWINSServer function will only accept two strings (primary and secondary only).
I would like to add three for additional redundancy. Is this possible to do through VBScript?
Thanks in advance,
Lance
When manually adding WINS server entries to any given network connection, you can add as many as you want. However, when using VBScript the SetWINSServer function will only accept two strings (primary and secondary only).
I would like to add three for additional redundancy. Is this possible to do through VBScript?
Thanks in advance,
Lance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sub SetStaticIP
Const DISCONNECTED = 0
Const CONNECTED = 2
Dim objNetworkSettings, objWMIService
Dim colNetCards, objNetCard
Dim strNetCardCaption, colItems, objItem
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Set objNetworkSettings = objWMIService.Get("Win32_N
Set colItems = objWMIService.ExecQuery("S
For Each objItem in colItems
Dim errEnable
Set colNetCards = objWMIService.ExecQuery("S
' NetConnectionStatus only works on XP!!!
If objItem.NetConnectionStatu
For Each objNetCard in colNetCards
Dim oReg
Dim strSettingID, strKeyPath, MultValueName, Return
' Set WINS addresses
strSettingID = objNetCard.SettingID
const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath = "SYSTEM\CurrentControlSet\
MultValueName = "NameServerList"
Set oReg=GetObject("winmgmts:{
strComputer & "\root\default:StdRegProv"
Return = oReg.SetMultiStringValue(H
If (Return <> 0) Or (Err.Number <> 0) Then
Wscript.Echo "Could not set the value of HKEY_LOCAL_MACHINE\" & strKeyPath & "\" & MultValueName & " (Error = " & Err.Number & ")."
End If
Next
Else
For Each objNetCard in colNetCards
...
Next
End If
Next
End Sub