Simple howto.
No additional third side software required. Windows built-in task scheduler used. Username and password arguments NOT required for command.
This assumes you're using Windows 10 built-in VPN and already saved VPN connection (saved username and password). Probably will work on older Windows versions too.
First of all find saved VPN connection parameters fileC:\Users\YOURUSERNAME\AppData\Roaming\Microsoft\Network\Connections\Pbk\rasphone.pbk
PreviewUserPw=1
PreviewUserPw=0
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2021-12-30T14:40:51.0713534</Date>
<Author>DOMAIN\YOURUSERNAME</Author>
<URI>\VPN reconnect task</URI>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription><QueryList><Query Id="0" Path="Application"><Select Path="Application">*[System[Provider[@Name='RasClient'] and EventID=20226]]</Select></Query></QueryList></Subscription>
</EventTrigger>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription><QueryList><Query Id="0" Path="Microsoft-Windows-NetworkProfile/Operational"><Select Path="Microsoft-Windows-NetworkProfile/Operational">*[System[Provider[@Name='NetworkProfile'] and EventID=10000]]</Select></Query></QueryList></Subscription>
</EventTrigger>
</Triggers>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>C:\Windows\System32\rasphone.exe</Command>
<Arguments>-d "YOURVPNNAME" -f C:\Users\YOURUSERNAME\AppData\Roaming\Microsoft\Network\Connections\Pbk\rasphone.pbk</Arguments>
</Exec>
</Actions>
</Task>
Next open Windows Task Scheduler and import this file. New task will be created.
Try to Run/Enable it.
Connect/Disconnect VPN.
If setup is correct, VPN should reconnect right after disconnection.
«« Airam Campus galda lampai kirdik | E-pastu migrācija no gmail »» |