Execute a specific program-WIN7 when connecting to the network

Source: Internet
Author: User

There may be such a need. When we are in the company, we need to enable the gateway verification program after connecting to the company's network, and enable the VPN after connecting to the network at home. That is, you want to execute certain programs when connecting to a specific network.

 

Step 0.Preparation

Clear thinking: When the network changes, some events will be recorded, so the specific program we execute will be recorded after some specific events.

Related procedures: Control Panel-management tools-view log events, control panel-management tools-Schedule Tasks

[01]

[02]

Step 1.Connect to the network to obtain a specificEvent ID.

In the left-side tree of the NIC connection log event, expand: Application and service logs-Microsoft-Windows-WLAN-AutoConfig-Operational. First, clear the logs and connect to the company's network. Next we can see a series of events.

[11]

From the event details, confirm the corresponding networkSSID. (The IDs of network events are different)

[12]

Step 2.Attach the operations of the execution program to a specific event

[21]

After setting, you can view the corresponding event in the scheduled task.

[22]

Step 3.When the network is disconnected, close the program in the previous step.

Clear Microsoft-Windows-WLAN-AutoConfig-Operational logs when the network connection is normal, and then disconnect the network. Find the corresponding event ID and repeat Step 2.

PS: linux, ubuntu directly put the script in/etc/network/if-up.d/and/etc/network/if-dn.d/, mac osx has not found the corresponding method, if you know anything, please let us know. Thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.