Due to the need to do some server maintenance, in order to facilitate maintenance, on the server installed a 4G wireless internet card. But because of the network instability, often in the use of a two days after the disconnection, unable to remotely connect, is very distressed. On the internet for a long time have not found any good solution.
Just today, web search found a post "standby wake up automatically connect broadband", and I want to solve the problem has the same feeling, so I tried a try, really good, and quickly share to everyone.
1, first create a new text file, write the following VBS code, and save as a VBS file;
CreateObject ("wscript.shell"). Run"rasdial broadband connection name User name password ",0
This line of code enables dialing for a specified broadband connection. I here wireless on the network card, no user name password, directly fill in the broadband name on the line, save as Cmiot.vbs.
CreateObject ("wscript.shell"). Run"rasdial cmiot",0
2, new task plan, automatically redial when the network is disconnected;
Inspired by this article, "Using Python to control DDNS parsing," The system event is observed when the connection to the Internet card is disconnected.
As you can see, the ISATAP interface generates new events each time the network is connected and disconnected, and the event IDs are 4200 and 4201, which is good, we only need to run the Cmiot.vbs program when the ISATAP interface generates the 4201 event to enable the wire break redial.
Create a new Task Scheduler, trigger select "When a specific event is logged", the trigger content is filled out as follows, the action select "Start Program", and select the first step saved VBS file, complete.
3. Measured effect
Disconnect the network for testing, and sure enough, immediately after the 4201 incident, escalate the 4200 event, and the network automatically connects successfully.
Using Task Scheduler to realize the disconnection of Internet card