Bill Powell
2024-02-21 07:23:18 UTC
A few times a day I use the script below to connect to a free VPN named
https://www.freeopenvpn.org/
It's open to everyone without needing to create an account.
So this script, if improved, would greatly benefit everyone using it.
Most of freeopenvpn setup is static, but the password changes constantly.
Config: USA_freeopenvpn_tcp.ovpn (the contents change about twice a year)
Username: freeopenvpn (this remains the same for years)
Password/PIN: This 9-digit number changes a few times a day
For the username and password, I usually add this line to the config files:
for %f in (*.ovpn) do type C:\freeopenvpn\freeopenvpninclude.txt >> %f
Where the "freeopenvpninclude.txt" file contains this single line:
auth-user-pass C:\\freeopenvpn\\freeopenvpnauthuserpass.txt
And where the "freeopenvpnauthurserpass.txt" file contains two lines:
freeopenvpn
123456789
Where nothing changes quickly except that one 9-digit password above.
I don't use the OpenVPN GUI since I connect to the VPN via
doubleclicking the batch file below, whose last line is
what skirts around the Windows UAC popups (yes, I know, if you
don't like that part, just uncomment the part above it then),
and I don't feel like typing the VPN password each time which
is the second point of having the script (instead of the OpenVPN GUI).
Here's the current short script which, if the username/password
is already set, will work for anyone without need for user input.
RUN-ONLY BATCH SCRIPT:
@echo off
set configfile=USA_freeopenvpn_tcp.ovpn
REM set configfile=USA_freeopenvpn_udp.ovpn
set configcmd=C:\Program Files\OpenVPN\bin\openvpn.exe
set configdir=C:\freeopenvpn\config\
REM %configcmd% %configdir%%configfile%
c:\windows\system32\runas.exe /user:administrator /savecred "%configcmd% %configdir%%configfile%"
But a few times a day, the 9-digit password changes so user input
is required. To do that, I run this setup-and-run script instead.
SETUP-AND-RUN BATCH SCRIPT:
@echo off
echo "Append the username/password to all freeopenvpn ovpn config files"
echo "auth-user-pass C:\\freeopenvpn\\freeopenvpnauthuserpass.txt"
pause
echo "Get the latest 9-digit password from https://www.freeopenvpn.org/premium.php"
"C:\Users\username\AppData\Local\Epic Privacy Browser\Application\epic.exe" "https://www.freeopenvpn.org/premium.php" &
set /p user_input=Enter 9-digit password here"
echo %user_input%
REM it might be nice to count the number of digits to ensure it's 9 in number
pause
echo "Paste that latest 9-digit password into the freeopenvpnauthuserpass.txt file"
C:\Windows\notepad.exe "C:\\freeopenvpn\\freeopenvpnauthuserpass.txt" &
pause
cd C:\\freeopenvpn\
set configfile=USA_freeopenvpn_tcp.ovpn
REM set configfile=USA_freeopenvpn_udp.ovpn
set configcmd=C:\Program Files\OpenVPN\bin\openvpn.exe
set configdir=C:\freeopenvpn\config\
REM %configcmd% %configdir%%configfile%
c:\windows\system32\runas.exe /user:administrator /savecred "%configcmd% %configdir%%configfile%"
The reason this is posted is to help others connect to the same free
freeopenvpn VPN service without needing to invoke the OpenVPN GUI.
While I'm well aware that some people won't like that it bypasses
UAC, all they have to do to NOT bypass UAC is uncomment the
penultimate line and comment out the last line so that's not where
improvements are going to be found (unless you have a better solution,
which, yes, I know, involves shortcuts & the Windows task manager).
But that's complicated.
This is simple.
And I'm not worried about my kids or my dog accessing my computer.
If you can improve this file (other than the UAC part), then that
would be useful to thousands of people since it works for everyone.
https://www.freeopenvpn.org/
It's open to everyone without needing to create an account.
So this script, if improved, would greatly benefit everyone using it.
Most of freeopenvpn setup is static, but the password changes constantly.
Config: USA_freeopenvpn_tcp.ovpn (the contents change about twice a year)
Username: freeopenvpn (this remains the same for years)
Password/PIN: This 9-digit number changes a few times a day
For the username and password, I usually add this line to the config files:
for %f in (*.ovpn) do type C:\freeopenvpn\freeopenvpninclude.txt >> %f
Where the "freeopenvpninclude.txt" file contains this single line:
auth-user-pass C:\\freeopenvpn\\freeopenvpnauthuserpass.txt
And where the "freeopenvpnauthurserpass.txt" file contains two lines:
freeopenvpn
123456789
Where nothing changes quickly except that one 9-digit password above.
I don't use the OpenVPN GUI since I connect to the VPN via
doubleclicking the batch file below, whose last line is
what skirts around the Windows UAC popups (yes, I know, if you
don't like that part, just uncomment the part above it then),
and I don't feel like typing the VPN password each time which
is the second point of having the script (instead of the OpenVPN GUI).
Here's the current short script which, if the username/password
is already set, will work for anyone without need for user input.
RUN-ONLY BATCH SCRIPT:
@echo off
set configfile=USA_freeopenvpn_tcp.ovpn
REM set configfile=USA_freeopenvpn_udp.ovpn
set configcmd=C:\Program Files\OpenVPN\bin\openvpn.exe
set configdir=C:\freeopenvpn\config\
REM %configcmd% %configdir%%configfile%
c:\windows\system32\runas.exe /user:administrator /savecred "%configcmd% %configdir%%configfile%"
But a few times a day, the 9-digit password changes so user input
is required. To do that, I run this setup-and-run script instead.
SETUP-AND-RUN BATCH SCRIPT:
@echo off
echo "Append the username/password to all freeopenvpn ovpn config files"
echo "auth-user-pass C:\\freeopenvpn\\freeopenvpnauthuserpass.txt"
pause
echo "Get the latest 9-digit password from https://www.freeopenvpn.org/premium.php"
"C:\Users\username\AppData\Local\Epic Privacy Browser\Application\epic.exe" "https://www.freeopenvpn.org/premium.php" &
set /p user_input=Enter 9-digit password here"
echo %user_input%
REM it might be nice to count the number of digits to ensure it's 9 in number
pause
echo "Paste that latest 9-digit password into the freeopenvpnauthuserpass.txt file"
C:\Windows\notepad.exe "C:\\freeopenvpn\\freeopenvpnauthuserpass.txt" &
pause
cd C:\\freeopenvpn\
set configfile=USA_freeopenvpn_tcp.ovpn
REM set configfile=USA_freeopenvpn_udp.ovpn
set configcmd=C:\Program Files\OpenVPN\bin\openvpn.exe
set configdir=C:\freeopenvpn\config\
REM %configcmd% %configdir%%configfile%
c:\windows\system32\runas.exe /user:administrator /savecred "%configcmd% %configdir%%configfile%"
The reason this is posted is to help others connect to the same free
freeopenvpn VPN service without needing to invoke the OpenVPN GUI.
While I'm well aware that some people won't like that it bypasses
UAC, all they have to do to NOT bypass UAC is uncomment the
penultimate line and comment out the last line so that's not where
improvements are going to be found (unless you have a better solution,
which, yes, I know, involves shortcuts & the Windows task manager).
But that's complicated.
This is simple.
And I'm not worried about my kids or my dog accessing my computer.
If you can improve this file (other than the UAC part), then that
would be useful to thousands of people since it works for everyone.