Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.os.windows-10 > #148408

Re: Why Windows 10 batch admin isn't the same as its GUI admin?

From Scott Lurndal <scott@slp53.sl.home>
Newsgroups alt.comp.os.windows-10, alt.comp.microsoft.windows, alt.msdos.batch
Subject Re: Why Windows 10 batch admin isn't the same as its GUI admin?
Date 2021-09-12 06:00 +0300
Organization UsenetServer - www.usenetserver.com
Message-ID <shjqg4$uoh$1@gioia.aioe.org> (permalink)
References <she5mh$17nl$1@gioia.aioe.org> <a9vljg9tspkefitk4ao7qr076t60ron1r1@4ax.com> <shgjd7$1206$1@gioia.aioe.org> <shhrcb$cgu$1@gioia.aioe.org> <shj746$95n$1@dont-email.me>

Cross-posted to 3 groups.

Show all headers | View raw


Zaidy036 writes:
> easier to use "CMD /K" so batch ends but leaves window open and usable

Done.
Please see improvements to the tutorial for all to test, below.

Tutorial: How to use freeopenvpn on Windows 10 from the command line
(Please add improvements, e.g., how to wget the password would be nice.)
(Also how to doubleclick on the OVPN files & bypass UAC 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 the GUI that most would use).
   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 common free example (password changes daily):
   https://www.freeopenvpn.org/
   https://www.freeopenvpn.org/ovpn/USA_freeopenvpn_udp.ovpn

   Here is another common free set of openvpn configuration files:
   https://vanwa.tech/vpn 
   https://vanwa.tech/free-openvpn-service
   https://vanwa.tech/download-free-openvpn-config

   And others which don't even require a change of login/password:
   https://www.vpngate.net/en/
   
   For example, this file changes infrequently during the year.
   https://www.freeopenvpn.org/ovpn/USA_freeopenvpn_udp.ovpn

   Save that file to wherever you want to store your VPN configs.
   c:\pathto\configs\freeopenvpn.ovpn

3. Create a freeopenvpn.txt text file for the login & daily password.
   notepad.exe freeopenvpn.txt

   Each OpenVPN config file can authenticate differently.
   Adjust what you do based on their authentication method.
   For example, for freeopenvpn.org, I'd create a login/password file.

   In that file I'd put the current login & password, each on a line.
    freeopenvpn
    173975185

   Note that the freeopenvpn.org password changes frequently.

4. Then I'd modify the config file to find the login/password. 
   C:\> notepad.exe USA_freeopenvpn_udp.ovpn

   Change this line from: 
    auth-user-pass 
   Change that line to the full path to the login/password file:   
    auth-user-pass c:\\pathto\\configs\\freeopenvpn.txt 

5. Create a batch command to run VPN for you as administrator.
   notepad.exe freeopenvpn.bat

   In that file you can add one line to call the desired config file.
   c:\pathto\openvpn\bin\openvpn.exe c:\pathto\configs\freeopenvpn.ovpn

   If desired, add paths, variables and/or a pause in case of error.

    REM freeopenvpn.bat
    cd c:\pathto\configs\
    c:\pathto\openvpn\bin\openvpn.exe c:\pathto\configs\freeopenvpn.ovpn
    pause

   Or, if you want to use variables, something like this would be ok:
    REM freeopenvpn.bat
    REM https://www.freeopenvpn.org/premium.php?cntid=USA&lang=en
    set configdir=c:\pathto\configs\
    set configcmd=c:\pathto\openvpn\bin\openvpn.exe
    set configfile=freeopenvpn.ovpn
    cd $configdir
    %configcmd% %configdir%%configfile%
    pause

6. Now you can get on that free VPN by any of a few efficient methods:

   I usually run it from the command line inside an administrator window:
    Win+R > cmd{ctrl+shft+rtn}
    C:\> .\freeopenvpn.bat

   But you can also run it as admin via the Windows File Explorer.
    {Rightclick on freeopenvpn.bat}{Select "Run as administrator"}

   Or, in an administrator window, you can directly run the commands:
    c:\pathto\openvpn\bin\openvpn.exe c:\pathto\configs\freeopenvpn.ovpn

   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.

   You can create a command to run in the Run box if you like.
    REM curlit.bat
    %comspec% /k curl icanhazip.com

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. Press "F4" in the resulting command window when you wish to exit.

9. Steps are similar for https://vanwa.tech and in some ways even simpler:
   REM vanwa.bat
   REM https://vanwa.tech/download-free-openvpn-config
   set configfile=vanwa.ovpn
   set configcmd=c:\pathto\openvpn\bin\openvpn.exe
   set configdir=c:\pathto\configs\
   cd $configdir
   %configcmd% %configdir%%configfile%
   pause

10. Steps are similar but with different proclivities for vpngate.net:
    REM vpngate.net 
    set configfile=vpngate.ovpn
    set configcmd=c:\pathto\openvpn\bin\openvpn.exe
    set configdir=c:\pathto\configs\
    cd $configdir
    %configcmd% %configdir%%configfile%
    pause

In summary, this tutorial provides a step by step tested sequence
that allows you efficiently to be on any one set of free public VPNs 
using the Windows 10 command line or Windows 10 File Explorer.

Let me know if you have further improvements for all to benefit from 
(e.g., to wget the password file daily automatically would be nice,
and it would be nice to set up Windows 10 so as to run openvpn.exe as 
admin when any ovpn file is doubleclicked on in the Windows File Explorer.)

Back to alt.comp.os.windows-10 | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-10 02:34 +0300
  Re: Why Windows 10 batch admin isn't the same as its GUI admin? Ralph Fox <-rf-nz-@-.invalid> - 2021-09-10 19:08 +1200
    Re: Why Windows 10 batch admin isn't the same as its GUI admin? Paul <nospam@needed.invalid> - 2021-09-10 04:45 -0400
      Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-11 12:18 +0300
        Re: Why Windows 10 batch admin isn't the same as its GUI admin? Andy Burns <usenet@andyburns.uk> - 2021-09-11 10:26 +0100
          Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-11 22:08 +0300
            Re: Why Windows 10 batch admin isn't the same as its GUI admin? Andy Burns <usenet@andyburns.uk> - 2021-09-11 20:15 +0100
          Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-12 13:25 +0300
      Re: Why Windows 10 batch admin isn't the same as its GUI admin? Ralph Fox <-rf-nz-@-.invalid> - 2021-09-12 06:58 +1200
        Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-11 22:59 +0300
    Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-11 00:40 +0300
      Re: Why Windows 10 batch admin isn't the same as its GUI admin? Andy Burns <usenet@andyburns.uk> - 2021-09-11 08:57 +0100
        Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-11 11:26 +0300
          Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-11 11:33 +0300
            Re: Why Windows 10 batch admin isn't the same as its GUI admin? Andy Burns <usenet@andyburns.uk> - 2021-09-11 09:44 +0100
      Re: Why Windows 10 batch admin isn't the same as its GUI admin? Herbert Kleebauer <klee@unibwm.de> - 2021-09-11 11:03 +0200
        Re: Why Windows 10 batch admin isn't the same as its GUI admin? Andy Burns <usenet@andyburns.uk> - 2021-09-11 10:05 +0100
          Re: Why Windows 10 batch admin isn't the same as its GUI admin? Ralph Fox <-rf-nz-@-.invalid> - 2021-09-12 07:15 +1200
        Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-11 13:00 +0300
        Re: Why Windows 10 batch admin isn't the same as its GUI admin? Zaidy036 <Zaidy036@air.isp.spam> - 2021-09-11 17:29 -0400
          Re: Why Windows 10 batch admin isn't the same as its GUI admin? Ralph Fox <-rf-nz-@-.invalid> - 2021-09-12 09:48 +1200
            Re: Why Windows 10 batch admin isn't the same as its GUI admin? Paul <nospam@needed.invalid> - 2021-09-11 18:54 -0400
              Re: Why Windows 10 batch admin isn't the same as its GUI admin? Ralph Fox <-rf-nz-@-.invalid> - 2021-09-12 11:30 +1200
                Re: Why Windows 10 batch admin isn't the same as its GUI admin? Paul <nospam@needed.invalid> - 2021-09-11 23:47 -0400
          Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-12 06:00 +0300
            Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-12 12:11 +0300
  Re: Why Windows 10 batch admin isn't the same as its GUI admin? JJ <jj4public@gmail.com> - 2021-09-10 16:47 +0700
    Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-11 00:22 +0300
  Re: Why Windows 10 batch admin isn't the same as its GUI admin? Brian Gregory <void-invalid-dead-dontuse@email.invalid> - 2021-09-12 10:25 +0100
    Re: Why Windows 10 batch admin isn't the same as its GUI admin? Scott Lurndal <scott@slp53.sl.home> - 2021-09-12 14:34 +0300

csiph-web