Top Nav

Windows Task Scheduler: Trigger an Event When Internet Connects/Disconnects

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:

Launch Windows Task Scheduler from All Programs –> Accessories –> System Tools.

Click Action –> Create Task…

Trigger an Event on network connect

Give your task a name in the General tab, and then click Triggers and then click New.

display message on connect

In the Begin the task menu, choose “On an event.” Then, choose:

Log: Microsoft-Windows-NetworkProfile/Operational
Source: NetworkProfile
Event ID: 10000

The 10000 Event ID is logged when you connect to a network.

networkprofile event id 10000

Click OK.

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.

trigger an event on network connect or disconnect

Add some actions in the Actions tab and then click OK to finish making your task.

do something when computer connects to web

Test it out by disconnecting and then reconnecting your Internet.

automatically start program when computer connects to network

It worked!

To create an event that’s triggered when the network is disconnected, do everything the same except use 10001 for the Event ID.

Log: Microsoft-Windows-NetworkProfile/Operational
Source: NetworkProfile
Event ID: 10001

automatically run program when computer disconnects

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).

start program when computer connects or disconnects

Test it out by disconnecting your network.

display message or log event when computer loses internet connection

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. Stay tuned for some groovy tricks where I’ll demonstrate a few more ideas!

Featured image by Elembis — GFDL (, CC-BY-SA-3.0 ( or CC-BY-SA-2.5-2.0-1.0 (, via Wikimedia Commons.

More Reading:

, ,

16 Responses to Windows Task Scheduler: Trigger an Event When Internet Connects/Disconnects

  1. Sameer Khan November 2, 2012 at 1:39 pm #

    didn’t work for me !!!

    • Jack Busch November 4, 2012 at 5:16 pm #

      hmm. are you on a wired or wireless connection? which version of windows are you running? Perhaps try tweaking some of the items in the Conditions tab. Start with no conditions and add them back to see which one may be causing the issue.

  2. Nam June 7, 2013 at 2:31 pm #

    I tested this on a wireless connection with no dice. Win 7 Enterprise. Domain-joined machine. I check the event logs and I don’t see the one in question. Should be under Application logs according to what I’ve found.

  3. Linh Hoang March 21, 2014 at 2:36 am #

    Just exactly what i’m looking for, works like charm. Thanks a lot Jack Busch for a priceless post.


  4. Tommy Smith June 6, 2014 at 7:48 am #

    I’m trying to use this technique, but I’m wondering if it is possible to only have this trigger when the internet connection actually works? (like, not Limited access etc.) the reason being that I’m on one of those unsecured networks that require you “agree to the terms of service” before you can use it. Is there a seperate code for when the internet connects AND works?

  5. Kumaran December 24, 2015 at 2:57 pm #

    It worked Fanstatic. I was searching for this Long time.
    Thanks..Great Job

  6. Amit January 25, 2016 at 8:11 am #

    I’m looking for something similar to this… I don’t want the on-connection EVENT, I just want to trigger an event at a certain time IF i’m online… is it possible?

  7. Eric February 25, 2016 at 10:44 am #

    Hello Jack,

    Thanks for this info.
    I’m looking to trigger the task when the network adapter is disabled / enabled (like from device manager). Which event can I use to detect it (Log / source / Event ID)?

    Thanks in advance.

    • Amit February 26, 2016 at 2:02 am #

      I needed the same thing. Once you create the task on whatever trigger, check the Properties -> Conditions. In there at the bottom you should have a Network option that might do what you wants. (Info from Win10… not sure in other versions).

  8. Eric February 27, 2016 at 11:10 pm #


    The option is also available in Win7. However, that’s not what I was looking for.
    I need the task to run whenever it detects that the network card has been disabled/enabled.

  9. Bryan November 25, 2016 at 12:46 pm #

    Event ID 8001 for successful WiFi connection and 8003 for disconnect are being recorded in Applications and Services > Microsoft > Windows > WLAN-AutoConfig > Operational. For wired connection there are events 10000 (connected) & 10001 (disconnect) in Applications and Services > Microsoft > Windows > Network Profile Operational.

    • Eric November 30, 2016 at 8:43 am #


      Thank you for taking the time to check these events.

      I have already found those EventIDs by myself (I needed only the LAN events).

      There’s actually another very important EventID: 50033 (LAN interface added)
      Adding it to trigger my scheduled task solved my specific LAN problem completely.

      • Eric November 30, 2016 at 8:46 am #

        Forgot to mention:
        EventID 50033 is recorded in Applications and Services > Microsoft > Windows > Dhcp-Client/Operational

    • Rob B February 15, 2017 at 7:58 am #

      Will 8003 work if the internet connection is lost but the network connection is not? I have a win 7 computer that drops wifi internet and only reconnects after a reboot. I am going to give it a try. Good article and thread. Thanks.

      • Rob B February 16, 2017 at 7:29 am #

        An answer to my own question:

        8003 will not trigger in a Win 7 wifi machine that suffers from ‘No Network Access’ on a daily basis. In my case the computer drops internet but continues to be connected to the wifi network. I will look for other EventIDs. I am so close.

  10. Daan August 24, 2017 at 2:54 pm #

    Can you do the same if you disconnect your power adapter (laptop?)

Leave a Reply


Free Learning


Don't miss a single tip, how to or tech news update. Subscribe to my free newsletter and receive updates, right to your inbox.

You have Successfully Subscribed!