{"id":9906,"date":"2021-12-05T00:09:24","date_gmt":"2021-12-05T00:09:24","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=9906"},"modified":"2021-12-05T00:09:46","modified_gmt":"2021-12-05T00:09:46","slug":"solved-vbscript-to-change-ip-and-dns","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/vbscript-to-change-ip-and-dns\/21362.html","title":{"rendered":"Solved VBscript To Change Ip And DNS"},"content":{"rendered":"<p>My script don&#8217;t seem to change the DNS1 and DNS 2, can some-one help me please.<br \/>\nThanks<\/p>\n<p>Dim strIPAddress<br \/>\nDim strSubnetMask<br \/>\nDim strGateway<br \/>\nDim intGatewayMetric<br \/>\nDim strDns1<br \/>\nDim strDns2<\/p>\n<p>strIPAddress = &#8220;192.168.0.45&#8221;<br \/>\nstrSubnetMask = &#8220;255.255.252.0&#8221;<br \/>\nstrGateway = &#8220;192.168.0.1&#8221;<br \/>\nintGatewayMetric = 1<br \/>\nstrDns1 = &#8220;192.168.0.103&#8221;<br \/>\nstrDns2 = &#8220;192.168.0.200&#8221;<\/p>\n<p>Set objShell = WScript.CreateObject(&#8220;Wscript.Shell&#8221;)<br \/>\nobjShell.Run &#8220;netsh interface ip set address name=&#8221;&#8221;Local Area Connection&#8221;&#8221; static &#8221; &amp; strIPAddress &amp; &#8221; &#8221; &amp; strSubnetMask &amp; &#8221; &#8221; &amp; strGateway &amp; &#8221; &#8221; &amp; intGatewayMetric, 0, True<br \/>\n&#8216;objShell.Run &#8220;netsh interface ip set address name=&#8221;&#8221;Local Area Connection&#8221;&#8221; static &#8221; &amp; strIPAddress &amp; &#8221; &#8221; &amp; strSubnetMask &amp; &#8221; &#8221; &amp; strGateway &amp; &#8221; &#8221; &amp; intGatewayMetric, 0, True<br \/>\nobjShell.Run &#8220;netsh interface ip add dns name=&#8221;&#8221;Local Area Connection&#8221; &amp; strDns1, 0, True<br \/>\nobjShell.Run &#8220;netsh interface ip add dns name=&#8221;&#8221;Local Area Connection&#8221; &amp; strDns2, 0, True<br \/>\nSet objShell = Nothing<br \/>\nWScript.Quit<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":3},"question-category":[55],"question_tags":[],"class_list":["post-9906","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/9906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=9906"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=9906"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=9906"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=9906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}