Scott Lurndal
2021-09-09 23:34:43 UTC
Why doesn't right clicking on the batch command to select "run as admin"
work, when running the batch command in an admin window works just fine?
===== ===== ===== ===== =====
Tutorial: How to use freeopenvpn daily on Windows
(Please add improvements, e.g., how to wget the password would be nice.)
1. I assume you've already installed any decent free openvpn client.
This is the one I'd use (but I don't use their GUI).
https://openvpn.net/community-downloads/
For example, this is the most common 64-bit openvpn.exe client:
https://swupdate.openvpn.org/community/releases/OpenVPN-2.5.3-I601-amd64.msi
2. Then download any free openvpn configuration file off the net.
You can get these free configuration files from many locations.
This is just one example that is simple & easy to explain.
https://www.freeopenvpn.org/
For example, this file changes infrequently during the year.
https://www.freeopenvpn.org/ovpn/USA_freeopenvpn_udp.ovpn
Save this file to wherever you want to store your VPN configs.
.\USA_freeopenvpn_udp.ovpn
3. Create a freeopenvpn.txt text file for the login & daily password.
notepad.exe freeopenvpn.txt
In that file put the current login & password, each on a line.
freeopenvpn
173975185
4. Modify the downloaded config file to call that text file.
notepad.exe USA_freeopenvpn_udp.ovpn
Change this line from: auth-user-pass
Change that line to: auth-user-pass freeopenvpn.txt
5. Create a batch command to run VPN for you as administrator.
notepad.exe freeopenvpn.bat
In that file add one line to call the desired config file.
c:\path-to\openvpn\bin\openvpn.exe USA_freeopenvpn_udp.ovpn
(Please use the full path to where you installed the executable.)
6. Now you can run VPN at any time by rightclicking on the batch file
I usually run it from the command line inside an admin window:
Win+R > cmd{ctrl+shft+rtn}
C:\> .\freeopenvpn.bat
But you should be able to run it as admin via the Windows File Explorer.
{Rightclick on freeopenvpn.bat}{Select "Run as admin"}
Note that you must run openvpn.exe as admin on Windows 10.
Otherwise it won't be able to successfully modify the routing table.
You can check the routing table before and after running the command:
route print | more
7. Doublecheck that you are on VPN if you're not sure you're connected.
Win+R > cmd{Enter}
C:\> curl icanhazip.com
That should return whatever IP address you're connected as.
8. Each day you want to use VPN, check for the new password:
https://www.freeopenvpn.org/
a. Modify the password line, as needed, of the freeopenvpn.txt file.
b. Then rightclick on the batch file to get on VPN
c. Press "F4" in the resulting command window when you wish to exit.
In summary, to get on VPN, you just run the batch file as admin, and to get
off VPN, you just press F4 in the resulting command window.
Each day you have to get the latest password off the web site.
But you only need to enter that password into the text file.
Everything else stays the same day to day.
Let me know if you have ideas for improvement (e.g., to wget the password
file daily, automatically would be nice and to graphically run the batch
command as admin would also be nice).
Note: This is being sent using _that_ exact method above.
work, when running the batch command in an admin window works just fine?
===== ===== ===== ===== =====
Tutorial: How to use freeopenvpn daily on Windows
(Please add improvements, e.g., how to wget the password would be nice.)
1. I assume you've already installed any decent free openvpn client.
This is the one I'd use (but I don't use their GUI).
https://openvpn.net/community-downloads/
For example, this is the most common 64-bit openvpn.exe client:
https://swupdate.openvpn.org/community/releases/OpenVPN-2.5.3-I601-amd64.msi
2. Then download any free openvpn configuration file off the net.
You can get these free configuration files from many locations.
This is just one example that is simple & easy to explain.
https://www.freeopenvpn.org/
For example, this file changes infrequently during the year.
https://www.freeopenvpn.org/ovpn/USA_freeopenvpn_udp.ovpn
Save this file to wherever you want to store your VPN configs.
.\USA_freeopenvpn_udp.ovpn
3. Create a freeopenvpn.txt text file for the login & daily password.
notepad.exe freeopenvpn.txt
In that file put the current login & password, each on a line.
freeopenvpn
173975185
4. Modify the downloaded config file to call that text file.
notepad.exe USA_freeopenvpn_udp.ovpn
Change this line from: auth-user-pass
Change that line to: auth-user-pass freeopenvpn.txt
5. Create a batch command to run VPN for you as administrator.
notepad.exe freeopenvpn.bat
In that file add one line to call the desired config file.
c:\path-to\openvpn\bin\openvpn.exe USA_freeopenvpn_udp.ovpn
(Please use the full path to where you installed the executable.)
6. Now you can run VPN at any time by rightclicking on the batch file
I usually run it from the command line inside an admin window:
Win+R > cmd{ctrl+shft+rtn}
C:\> .\freeopenvpn.bat
But you should be able to run it as admin via the Windows File Explorer.
{Rightclick on freeopenvpn.bat}{Select "Run as admin"}
Note that you must run openvpn.exe as admin on Windows 10.
Otherwise it won't be able to successfully modify the routing table.
You can check the routing table before and after running the command:
route print | more
7. Doublecheck that you are on VPN if you're not sure you're connected.
Win+R > cmd{Enter}
C:\> curl icanhazip.com
That should return whatever IP address you're connected as.
8. Each day you want to use VPN, check for the new password:
https://www.freeopenvpn.org/
a. Modify the password line, as needed, of the freeopenvpn.txt file.
b. Then rightclick on the batch file to get on VPN
c. Press "F4" in the resulting command window when you wish to exit.
In summary, to get on VPN, you just run the batch file as admin, and to get
off VPN, you just press F4 in the resulting command window.
Each day you have to get the latest password off the web site.
But you only need to enter that password into the text file.
Everything else stays the same day to day.
Let me know if you have ideas for improvement (e.g., to wget the password
file daily, automatically would be nice and to graphically run the batch
command as admin would also be nice).
Note: This is being sent using _that_ exact method above.