Murat Senturk wrote:
> Actually this script not testing your connection at all.
> It just switching between default gateway values 0.0.0.0 to 192.168.0.1
> because of this reason your vpn connection works, when vpn up your pc is using vpn client's setted gateway address.
You just opened my eyes!
I think.
This whole time, I thought I was "dropping" the network connection,
which it "looked" like it was doing. But you're saying all it did
really was drop the LOCAL gateway (which happens to be my router).
Is that correct?
I only tested the VPN connection as I was seeing what could go wrong,
where I was surprised that the VPN connection stayed up even after I
hit the NetToggle icon - but you just explained why that happens.
I don't understand networking well so may I ask if this is what is
happening?
(1) When I am NOT on a VPN server, and the NetToggle is "on",
my packets go from my computer to my router (192.168.0.1)
and then to the Internet.
The Windows 10 network monitor/globe icon shows "monitor".
Network Destination 0.0.0.0
Netmask 0.0.0.0
Gateway 192.168.0.1 (my router's IP address)
Interface 192.168.0.2 (my computer's IP address)
Metric 36 (low)
(2) When I am NOT on a VPN server, and the NetToggle is "off",
my packets go from my computer to (0.0.0.0),
which is nowhere (I guess).
The Windows 10 network monitor/globe icon shows "globe".
Network Destination 127.0.0.1 (localhost)
Netmask 255.0.0.0
Gateway On-link (whatever that means)
Interface 127.0.0.1 (localhost)
Metric 331 (medium)
(3) When I am on a VPN server, and the NetToggle is "on",
now it gets more complicated (for me to unravel).
I think my packets go from my computer to my router (192.168.0.1)
and then to the VPN server (which is on the Internet).
The Windows 10 network monitor/globe icon shows "globe".
But the "route print|more" shows a lot of lines where
the "netmask" rules such that any packets NOT destined
for 192.168.0.1 get routed (it seems in two halves) to
the Internet. (I only sort of know how netmask works.)
If I ignore that the VPN setup seems to split the Internet
into two halves, essentially I think any packet NOT destined
for my local network gets routed from my computer to the VPN
server (but those packets must go through the router first).
Network Destination 0.0.0.0
Netmask 0.0.0.0 (anything destined for my local network)
Gateway 192.168.0.1 (my router)
Interface 192.168.0.2 (my computer)
Metric 36 (low)
Network Destination 0.0.0.0
Netmask 128.0.0.0 (the first half of the Internet)
Gateway 123.123.123.10 (the VPN server IP address)
Interface 123.123.123.9 (minus one of the VPN server IP address)
Metric 35 (lower)
Network Destination 128.0.0.0
Netmask 128.0.0.0 (the second half of the Internet)
Gateway 123.123.123.10 (the VPN server IP address)
Interface 123.123.123.9 (minus one of the VPN server IP address)
Metric 35 (lower)
(4) But then I toggle that NetToggle to "off".
Now when that NetToggle is "off", the VPN connection still
works (and the "monitor/globe" network icon shows "monitor").
My packets must be getting to the VPN server somehow, and
that means they must STILL be going through my router and
then to the VPN server, but how?
Didn't the NetToggle turn the router 192.168.0.1 gateway off?
(a "route print | more" is much more confusing now.)
(5) If the VPN connection suddenly dies (for whatever reason)
my packets go from my computer to nowhere I think.
A "route print" shows EVEWRYTHING as being "On-link",
whatever that means in this context.
Certainly it means the packets are not going to the router.
Even as I know (kind of) how a netmask works, this is all
a bit confusing, but thank you for opening my eyes.
While it doesn't work the way I thought it works, it works
ok because without VPN the NetToggle switch connects and
disconnects me from the router and with VPN it protects
me when the VPN connection unexpectedly suddenly dies.
So it's all good, even as I don't really understand it all.
BTW I found a few more examples where the scheduled task
has to be broken into two parts when the %comspec% is used.
These examples don't use "cmd" so the task fits on one line.
https://www.digitalcitizen.life/use-task-scheduler-launch-programs-without-uac-prompts/
https://www.raymond.cc/blog/task-scheduler-bypass-uac-prompt/
These examples use "cmd" so they break the task into two lines.
https://www.tenforums.com/tutorials/57690-create-elevated-shortcut-without-uac-prompt-windows-10-a.html
https://winaero.com/create-elevated-shortcut-to-skip-uac-prompt-in-windows-10/
https://www.download3k.com/articles/How-to-make-an-Elevated-Program-Shortcut-without-a-UAC-Prompt-in-Windows-00805