There are certain things that you might want to do every time your computer connects to the Internet or when your network connection is dropped; however, you might not always be around to do them.
Earlier, we showed you how to use Windows Task Scheduler to have your computer automatically wake or sleep at a certain time. Similar to that tip, you can set up Windows to perform tasks when a certain event occurs. One handy use of this feature is to trigger an event whenever your computer connects to the Internet or is disconnected from the Internet. You can use this to automatically send emails, save logs or do some other task when the Internet goes out and then comes back on. The key is to watch for two NetworkProfile event IDs: 10000 (connect) and 10001 (disconnect). Here’s how you use them.
Trigger an Event When Your Internet Connects or Disconnects with Task Scheduler
Launch Windows Task Scheduler from All Programs –> Accessories –> System Tools.
Click Action –> Create Task…
Give your task a name in the General tab, and then click Triggers and then click New.
In the “Begin the task” menu, choose “On an event.” Then, choose:
Event ID: 10000
The 10000 Event ID is logged when you connect to a network.
Go to the Conditions tab. Here, you might want to uncheck “Start the task only if the computer is on AC power” (for laptops). You may also want to specify a network using the “Start only if the following network connection is available:” menu. This can be handy if you want to only run the task if you are on your work connection, or if you don’t want to run it while on a public network or something like that.
Add some actions in the Actions tab and then click OK to finish making your task.
Test it out by disconnecting and then reconnecting your Internet.
To create an event that’s triggered when the network is disconnected, do everything the same except use 10001 for the Event ID.
Event ID: 10001
You’ll also want to make sure that there aren’t any network connection conditions (since you won’t be connected to the Internet when this happens).
Test it out by disconnecting your network.
Obviously, this is just an example of what’s possible using Windows Task Schedule to watch for events and then doing something interesting… Some for good… and some for evil.