Windows Task Scheduler can 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 run a program Internet goes out and then comes back on.
The specific event that will watch for are related to NetworkProfile with 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.
- In Actions Panel -> Create Task and Name it, like "Network Outage Monitor".
- From the Triggers Tab, create New
Log: Microsoft-Windows-NetworkProfile/Operational
Source: NetworkProfile
Event ID: 10000
The 10000 Event ID is logged when you connect to a network. - From the Actions Tab, create New and choose Start a Program, and select a program you would like to run when connection connects.
I choose this free program from NirSoft call NetworkTrafficView - Monitor the traffic on your network adapter (nirsoft.net) which allows you to inspect programs being run and endpoints, to make sure it's not malware. - Choose which network to monitor
- And finally choose your final Settings tab, choose and play with settings
Check mark "Allow task to be run on demand".