cyn0
cyn0

Reputation: 522

Launch a program when computer is connected to internet

I'm using windows 7. I wrote an application to fetch contents from a webpage. I want that application/ script to be executed automatically once the computer is connected to the internet. I tried Task scheduler, but I'm unable to find an event when computer is connected to internet.

Thanks

Upvotes: 0

Views: 3853

Answers (1)

cyn0
cyn0

Reputation: 522

Found answer. Thought it would help someone so sharing.

To trigger an event on connecting to the network:

Open the Task Scheduler. Programs > Accessories > System Tools. create a new task by clicking Create Task in the Actions panel on the right side.

add task

Give the task a name.

On the Triggers tab, click New... and select On an Event from the dropdown box.

dropdown trigger

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

Click OK, then go to the Conditions tab. Check the box for Start only if the following network connection is available and choose the network you want to run the script with Under the Actions tab, click New... and select Start a program. Enter the location of the script file you want to run, then click OK. Set any other task settings you want to, then click OK.

Setting an event for when you disconnect from the network:

Follow steps 2-4 above Use the following event trigger settings:

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

Skip steps 6-7, as you will no longer be attached to any network at all. This event will therefore run any time you disconnect from any network. Follow steps 8-9 again

Upvotes: 3

Related Questions