My script don’t seem to change the DNS1 and DNS 2, can some-one help me please.
Thanks
Dim strIPAddress
Dim strSubnetMask
Dim strGateway
Dim intGatewayMetric
Dim strDns1
Dim strDns2
strIPAddress = “192.168.0.45”
strSubnetMask = “255.255.252.0”
strGateway = “192.168.0.1”
intGatewayMetric = 1
strDns1 = “192.168.0.103”
strDns2 = “192.168.0.200”
Set objShell = WScript.CreateObject(“Wscript.Shell”)
objShell.Run “netsh interface ip set address name=””Local Area Connection”” static ” & strIPAddress & ” ” & strSubnetMask & ” ” & strGateway & ” ” & intGatewayMetric, 0, True
‘objShell.Run “netsh interface ip set address name=””Local Area Connection”” static ” & strIPAddress & ” ” & strSubnetMask & ” ” & strGateway & ” ” & intGatewayMetric, 0, True
objShell.Run “netsh interface ip add dns name=””Local Area Connection” & strDns1, 0, True
objShell.Run “netsh interface ip add dns name=””Local Area Connection” & strDns2, 0, True
Set objShell = Nothing
WScript.Quit
Dim strIPAddress Dim strSubnetMask Dim strGateway Dim intGatewayMetric Dim strDns1 Dim strDns2 strIPAddress = "10.10.10.50" strSubnetMask = "255.255.255.0" strGateway = "10.10.10.1" intGatewayMetric = 1 strDns1 = "10.10.10.9" strDns2 = "10.10.10.10" Set objShell = WScript.CreateObject("Wscript.Shell") objShell.Run "netsh interface ip set address name=""Local Area Connection"" static " & strIPAddress & " " & strSubnetMask & " " & strGateway & " " & intGatewayMetric, 0, True objShell.Run "netsh interface ip set dns name=""Local Area Connection"" static "& strDns1, 0, True objShell.Run "netsh interface ip add dns name=""Local Area Connection"" addr="& strDns2, 0, True Set objShell = Nothing WScript.QuitP.S. When running this on a Vista or Windows 7 box you must run it under elevated rights.