I am really thankfull to all nice people who reply to my question.
I mostly prefer to write a script that "programmatically" performs exactly
the same actions that you can do manually as follows:
From the "Network Connections" window, choose a specific connection e.g.
"Local Area Connection 1", choose the menue "Disable this network device".
Another script shall do the reverse, i.e. perform the menue "Enable this
network device" on "Local Area Connection 1".
I am sure that this is possible but I don't know how to do it. It seems
likely to me that this is done easily by a command within "netsh".
"BNSGuy" <daniel.a.murray@newsgroup> wrote in message
On Mar 31, 9:02 am, "M Shafaat" <pop...@newsgroup> wrote:
> I wish to disable and enable my Local Area Connection using scripts. Can
> anyone suggest a very simple script or command line using netsh etc for
> doing this?
> My main objective is to prevent virus attacks from the Internet when the
> machine is idle by disconnetcting my PC from the home network.
> Best regards,
> M Shafaat
Which is most important? dis- and re-enabling your connection? or
doing so only when the computer is "idle"? The former is relatively
simple and can be done using a variety of scripting techniques, or
even batch files. I imagine the latter would not be terribly
difficult (to some) either.
I would think the most straight forward way would be to script an
event sink that is triggered by the screen saver. (not personally sure
exactly how to do that, but I've seen event triggered actions
before). when the screen saver fires, the event sink would trigger
the function to disable/re-enable the internet connection. A caveat
would be that this would require the/a screen saver to be used. This
would also allow the screen saver timeout to 'control' the actions of
the connection dis-/re-enabler.
If you are not running/able to run a screen saver, or want to define
conditions other than what would trigger the screen saver... I'm sure
it's possible, but currently out of my skill set.