Jump to content

swich lan connection


Guest haar3
 Share

Recommended Posts

Guest haar3

hi

is it possible to make a script that changes my gateway and dns on my lan connection?

my problem is that i have 2 networks and every time i switch i have to edit the gateway an dns, in tcp/ip.

This must be something i can do in one-click with autoit, with 2 scripts, network1, network2 ?

thanks

Edited by haar3
Link to comment
Share on other sites

btw. its a win 98 machine, so "netsh" (only thing i found on the topic dont work)

<{POST_SNAPBACK}>

if you have the MS Platform SDK (free download from MSDN) check out this url in SDK: ms-help://MS.PSDKSVR2003SP1.1033/wmisdk/wmi/win32_networkadapterconfiguration.htm

i would just paste it, but there are alot of properties and methods listed, and it would make this post just HUGE. The explanation header on it is...

The Win32_NetworkAdapterConfiguration WMI class represents the attributes and behaviors of a network adapter. This class includes extra properties and methods that support the management of the TCP/IP and Internetworking Packet Exchange (IPX) protocols that are independent from the network adapter.

i believe that implementing that class would be a good 'behind the scenes' solution to your issue, but for a quick easy solution, you could just do it the old fashioned way and use ControlSend()'s etc, and have the script go through and change the settings just like you would do it yourself.
Link to comment
Share on other sites

Can you fileinstalled netsh to your 98 machine ? isnt it a stand alone exe? Or am i missing something really obvious here ?

If you could simply install it then you could just do

netsh interface ip set dns "Local Area Connection" static 192.168.0.2
Link to comment
Share on other sites

Can you fileinstalled netsh to your 98 machine ? isnt it a stand alone exe? Or am i missing something really obvious here ?

If you could simply install it then you could just do

netsh interface ip set dns "Local Area Connection" static 192.168.0.2

<{POST_SNAPBACK}>

Assuming it makes changes to network using that WMI Class, there are some properties and methods that are not supported prior to win2k. depending on how it works, i could see it failing on a 98 system
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...