I'm trying on my W10 to perform an automatic "route" command after a successful VPN connection. I tried it based on this short description here which is for W7 but seems so similar, but I can't make it work.
- My VPN connection is ok. It connects and disconnect anytime without problems.
- My route command is ok. If I launch it manually after connecting the VPN everything works fine.
- Of course, my VPN connection doesn't use the remote gateway as a default gateway. I want to do "split tunneling".
I investigated and the Windows event 20225 is still the same on W10 (RAS Connection Establishement). So this is right... why is not triggering the route command? I can see the 20225 events with RasClient as source in the application event viewer after connecting the VPN.
Of course, before trying all of this stuff, I tried to creating the route "persistently" using
-p parameter on route command but it doesn't work because the VPN interface doesn't exist when this route is added on every boot, so is not a valid option. So must be scheduled.
I did the task with elevated privileges with the same result, and marked the "Execute with elevated privileges" checkbox as well. The task appears as "never started". And if I try to launch it manually, it says "Task Scheduler service is not available. Task Scheduler will attemt to reconnect to it". But the task scheduler is working fine, other tasks can be scheduled or executed manually and they are working.
Anybody achieved this successfully?
I tried to change the trigger part to change "Basic" to "Custom" and I put a XPath filter in XML field trying to search for the event id:
<Query Id="0" Path="Application">
It neither worked.
The problem is the same. The task appears as "Never launched".
EDIT2 I noticed in event viewer that always, after a successful VPN connection (id 20225) there is always another event (id 900) which can be related... maybe everything is set up but something is blocking the trigger... I don't know. See this screenshot (sorry, the screenshot is in spanish):