Home All Groups Group Topic Archive Search About

Enable/Disable Network connection at once

Author
28 Apr 2007 10:48 PM
Fabio Rosa
Hi, in my line of work I have to do a tedious task quite a number of times
every day: enable one network connection and disable the other. What I
actually refer to is that on a laptop - where I have one wired and one
wireless connections - I have to switch between these two connections to
reach a network device I am working on, and from there I may need to reach
the wireless network to get something on the Internet. What I do is a manual
job: open network connections folder, right click one connection, say
"disable", and then double-click the other one. I wonder if someone could
help me out; I'm looking for something like a WSH script on my desktop that
would run this switching task.

Author
29 Apr 2007 4:48 PM
Dave Patrick
These may help.

http://msdn2.microsoft.com/en-us/library/aa390385.aspx
http://msdn2.microsoft.com/en-us/library/aa390364.aspx

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

Show quoteHide quote
"Fabio Rosa" wrote:
> Hi, in my line of work I have to do a tedious task quite a number of times
> every day: enable one network connection and disable the other. What I
> actually refer to is that on a laptop - where I have one wired and one
> wireless connections - I have to switch between these two connections to
> reach a network device I am working on, and from there I may need to reach
> the wireless network to get something on the Internet. What I do is a
> manual
> job: open network connections folder, right click one connection, say
> "disable", and then double-click the other one. I wonder if someone could
> help me out; I'm looking for something like a WSH script on my desktop
> that
> would run this switching task.
Are all your drivers up to date? click for free checkup

Author
10 May 2007 12:06 PM
Fabio Rosa
Dave,

Thanks for the illustrative answer. I got the point, now it is a question of
developing a script to perform the way I need it. Very helpful of you.

Show quoteHide quote
"Dave Patrick" wrote:

> These may help.
>
> http://msdn2.microsoft.com/en-us/library/aa390385.aspx
> http://msdn2.microsoft.com/en-us/library/aa390364.aspx
>
> --
>
> Regards,
>
> Dave Patrick ....Please no email replies - reply in newsgroup.
> Microsoft Certified Professional
> Microsoft MVP [Windows]
> http://www.microsoft.com/protect
>
> "Fabio Rosa" wrote:
> > Hi, in my line of work I have to do a tedious task quite a number of times
> > every day: enable one network connection and disable the other. What I
> > actually refer to is that on a laptop - where I have one wired and one
> > wireless connections - I have to switch between these two connections to
> > reach a network device I am working on, and from there I may need to reach
> > the wireless network to get something on the Internet. What I do is a
> > manual
> > job: open network connections folder, right click one connection, say
> > "disable", and then double-click the other one. I wonder if someone could
> > help me out; I'm looking for something like a WSH script on my desktop
> > that
> > would run this switching task.
>
Author
11 May 2007 3:24 AM
Dave Patrick
Good to hear it helps. You're welcome.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

Show quoteHide quote
"Fabio Rosa" wrote:
> Dave,
>
> Thanks for the illustrative answer. I got the point, now it is a question
> of
> developing a script to perform the way I need it. Very helpful of you.
Author
11 May 2007 3:34 PM
Oisin Grehan
You might find using the netsh.exe utility a bit easier than getting
tangled up in wmi. I have the same situation at home, and I find
loading netsh scripts easily done with a simple batch file:

1) configure your wifi to be active, then run:

netsh int ip dump > c:\wifi.netsh

2) configure your lan to be active, then run:

netsh int ip dump > c:\lan.netsh

then create two batch files (wifi.bat and lan.bat) to load these
scripts back in:

REM enable wifi
netsh < c:\wifi.netsh

and I'll leave the rest as a ridiculously simple exercise for the
reader ;-)

Hope this helps,

- Oisin

Show quoteHide quote
On Apr 29, 12:48 pm, "Dave Patrick" <DSPatr...@nospam.gmail.com>
wrote:
> These may help.
>
> http://msdn2.microsoft.com/en-us/library/aa390385.aspxhttp://msdn2.microsoft.com/en-us/library/aa390364.aspx
>
> --
>
> Regards,
>
> Dave Patrick ....Please no email replies - reply in newsgroup.
> Microsoft Certified Professional
> Microsoft MVP [Windows]http://www.microsoft.com/protect
>
>
>
> "Fabio Rosa" wrote:
> > Hi, in my line of work I have to do a tedious task quite a number of times
> > every day: enable one network connection and disable the other. What I
> > actually refer to is that on a laptop - where I have one wired and one
> > wireless connections - I have to switch between these two connections to
> > reach a network device I am working on, and from there I may need to reach
> > the wireless network to get something on the Internet. What I do is a
> > manual
> > job: open network connections folder, right click one connection, say
> > "disable", and then double-click the other one. I wonder if someone could
> > help me out; I'm looking for something like a WSH script on my desktop
> > that
> > would run this switching task.- Hide quoted text -
>
> - Show quoted text -
Author
13 May 2007 5:36 PM
Fabio Rosa
Oisin,

Thanks a lot for taking the time. Liked your solution - very elegant.
However, in my case I may need to tweak it a bit: while enabling one
connection, I must disable the other. I will work on it and post the
findings. And I totally agree it is much easier using the netsh.exe rather
than WMI - I was still studying a reasonable solution when saw your post.
Thanks again.

Regards,


Show quoteHide quote
"Oisin Grehan" wrote:

> You might find using the netsh.exe utility a bit easier than getting
> tangled up in wmi. I have the same situation at home, and I find
> loading netsh scripts easily done with a simple batch file:
>
> 1) configure your wifi to be active, then run:
>
> netsh int ip dump > c:\wifi.netsh
>
> 2) configure your lan to be active, then run:
>
> netsh int ip dump > c:\lan.netsh
>
> then create two batch files (wifi.bat and lan.bat) to load these
> scripts back in:
>
> REM enable wifi
> netsh < c:\wifi.netsh
>
> and I'll leave the rest as a ridiculously simple exercise for the
> reader ;-)
>
> Hope this helps,
>
> - Oisin
>
> On Apr 29, 12:48 pm, "Dave Patrick" <DSPatr...@nospam.gmail.com>
> wrote:
> > These may help.
> >
> > http://msdn2.microsoft.com/en-us/library/aa390385.aspxhttp://msdn2.microsoft.com/en-us/library/aa390364.aspx
> >
> > --
> >
> > Regards,
> >
> > Dave Patrick ....Please no email replies - reply in newsgroup.
> > Microsoft Certified Professional
> > Microsoft MVP [Windows]http://www.microsoft.com/protect
> >
> >
> >
> > "Fabio Rosa" wrote:
> > > Hi, in my line of work I have to do a tedious task quite a number of times
> > > every day: enable one network connection and disable the other. What I
> > > actually refer to is that on a laptop - where I have one wired and one
> > > wireless connections - I have to switch between these two connections to
> > > reach a network device I am working on, and from there I may need to reach
> > > the wireless network to get something on the Internet. What I do is a
> > > manual
> > > job: open network connections folder, right click one connection, say
> > > "disable", and then double-click the other one. I wonder if someone could
> > > help me out; I'm looking for something like a WSH script on my desktop
> > > that
> > > would run this switching task.- Hide quoted text -
> >
> > - Show quoted text -
>
>
>
Author
17 Feb 2009 1:48 PM
Salton
I think this the same problem that i have faced some days ago & i think I got a nice answer for this here!

http://forums.techarena.in/software-development/1118216.htm

Hope this helps you too! -- Salton ------------------------------------------------------------------------ Salton's Profile: http://forums.techarena.in/members/salton.htm View this thread: http://forums.techarena.in/server-scripting/737799.htmhttp://forums.techarena.in

Bookmark and Share

Post Thread options