My computer is almost always on. A rare exception is long trips far beyond the DS.
It is almost always included, because very often when I am away from home (at work, away, just in the summer at the dacha), it becomes necessary to go to it (via http or via Remote Desktop) for any data.
All anything, but access to the Internet is provided through a VPN-connection.
Which sometimes breaks off. Due to problems with the provider, due to a system reboot after installing critical updates or for any other reasons.
Until recently, every such break of communication caused me to lose my ability to connect to a computer while I was away from home before returning home and starting a VPN connection manually. Until one day I decided to sort out the problem and make a decision that would allow to forget about such unpleasant situations.
')
Having rummaged through the Internet, I discovered that it is possible to start a connection using the
rasdial.exe program included in the standard Windows set:
C:\Windows\system32\rasdial.exe [ [|*]] [/DOMAIN:]
[/PHONE:] [/CALLBACK:]
[/PHONEBOOK:] [/PREFIXSUFFIX]
Well, then start the connection on a schedule - a matter of technology.
Someone is closer to Task Scheduler + bat-files,
cron + perl is closer to me.
As with the attitude to color and taste of felt-tip pens, the complexity of the script is a personal matter.
You can even like this:
c:\windows\system32\rasdial.exe "_vpn_" _ _
And it can be a little more complicated.
For example, I first check the availability of the channel (by pinging to certain addresses), and then launching one of the VPN connections. If it is unavailable, launch another and so on.
Another interesting case (although less often needed by someone) of using the VPN autorun is switching between several connections on a schedule, for example, for use at night of one, and during the day of the other. In this case, the “break connection” option will help:
C:\Windows\system32\rasdial.exe [] /DISCONNECT
The only caveat to which you need to pay attention - under which user the script will be executed that manages the connections. If the VPN connection is not shared among all users of the system, the system may not find the connection when the script is started according to the schedule, since by default the tasks are started with the system user rights, and not the one under which debugging was performed.