Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to trigger an action as soon as I get connected to a network with a specific network interface i.e. local area connection 2? The OS is winXP. Thanks in advance

share|improve this question

I think some NIC software might do that. I think I saw something about this in my dell NIC software.

share|improve this answer

I'm fairly certain there's no XP functionality to launch an app based on plugging in the cable.

This is straying into Stack Overflow territory, but it looks as if there are definitely WMI events that you can grab onto - though I'm uncertain about whether you can get to these without churning out some code. Here's an example.

share|improve this answer

Definitely worth asking this on Stack Overflow as well, because it's will have to be a programatic solution.

share|improve this answer

There are no built in applications that can do this that I'm aware of and I haven't come across any general purpose third party apps that do anything reusable.

If you have a developer handy you can roll your own. I've built a number of applications ( Windows 2000\XP so this should work for you) that use the IPHelper API's NotifyRouteChange function to register a callback that reacts to any change in the routing table. This has proven to be very reliable and rapid as it responds to things like connecting\disconnecting a LAN or WLAN as soon as the adapter's IP-address becomes usable. This is generally a couple of seconds after a cable is plugged in, at most. It is (obviously) limited to IP networks though.

The System Event Notification System (SENS) has mechanisms designed to be used for this purpose (specifically the ISENSNetwork::ConnectionMade Method) but my experience with this and other SENS functionality is that they can take minutes to trigger. This appears to be intentional as SENS is intended to provide applications with mechanisms to adjust their behavior to network state changes over time (e.g. degradation of link quality), rather than to provide instantaneous reactions such as a response to a new connection being made.

This probably does belong over on StackOverflow though.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.