Howdy all,

I am trying to create a windows.vbs script that will set the IP info for a network card.
There was a sample script on MS site (thanks ScriptGuys) but it didn't have the DNS setting syntax. I have the syntax for setting 1 DNS server but would like to be able to set multiple.

The reason for this is going to multiple client sites, some of which use DHCP and others don't. I get really tired of typing in the info repeatedly. It would be nice to run a script with that sites configuration.

Like I say, I have the IP addy & 1 DNS entry working and am hoping that someone knows the syntax to enable multiple DNS entries.

Thanks for any assistance.

here is the script

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("x.x.x.x") 'IP address
strSubnetMask = Array("x.x.x.x") 'subnet mask
strGateway = Array("x.x.x.x") 'client's default gateway
strGatewayMetric = Array(1)
strDNS = Array("x.x.x.x")
'strDNS2 = Array("x.x.x.x") 'This is where the problem lies

For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewayMetric)
errDNS = objNetAdapter.setDNSServerSearchOrder(strDNS)
'errDNS2 = objNetAdapter.setDNSServerSearchOrder(strDNS2)

If errEnable = 0 Then
WScript.Echo "The IP address has been changed."
WScript.Echo "The IP address could not be changed."
End If