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


Groups > alt.comp.microsoft.windows > #1055 > unrolled thread

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

Started byScott Lurndal <scott@slp53.sl.home>
First post2021-09-10 02:34 +0300
Last post2021-09-12 14:34 +0300
Articles 2 on this page of 22 — 6 participants

Back to article view | Back to alt.comp.microsoft.windows


Contents

  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? 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? 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? 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? 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? 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? 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? 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

Page 2 of 2 — ← Prev page 1 [2]


#1077

FromBrian Gregory <void-invalid-dead-dontuse@email.invalid>
Date2021-09-12 10:25 +0100
Message-ID<iq5vbeF2hu1U1@mid.individual.net>
In reply to#1055
On 10/09/2021 00:34, Scott Lurndal wrote:
> 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?
>... 

I think right clicking and running as administrator tends to change the 
current directory to your user directory. Could that be the problem?

-- 
Brian Gregory (in England).

[toc] | [prev] | [next] | [standalone]


#1079

FromScott Lurndal <scott@slp53.sl.home>
Date2021-09-12 14:34 +0300
Message-ID<shkojr$1nm9$1@gioia.aioe.org>
In reply to#1077
Brian Gregory writes:
> I think right clicking and running as administrator tends to change the 
> current directory to your user directory. Could that be the problem?

Yes. The problem was explained first by Herbert Kleebauer.

So that everyone always benefits, here is the latest tutorial update, with many improvements using Windows tricks.

Tutorial: How to _efficiently_ set up free openvpn on Windows 10

Note this is not the default documented openvpn GUI installation setup method. If you want to use the default openvpn GUI, follow instructions at the site you obtained the OpenVPN client software.

This is how I set up openvpn to work efficiently with _many_ ovpn files.

1. Download and install a free open source Windows "openvpn" client.
   This is the one I'd use:  https://openvpn.net/community-downloads/
   https://swupdate.openvpn.org/community/releases/OpenVPN-2.5.3-I601-amd64.msi

   Note the default use model is the OpenVPN client GUI.
   I use the OpenVPN client executable instead, for more direct control.

   After installation, I change a few things to garner more control:
   a. I change the *.ovpn file association from the GUI to the client.
   b. I set permissions for OpenVPN/bin/*.exe to run as administrator.
   c. I add a 32-bit registry DWORD to open more than 15 files.
   d. I set OpenVPN Daemon to open logs in the same spot.
   e. Optionally, I bypass the UAC nag screen (or change the sound).

A. Set the Windows 10 file association for *.ovpn to open in the daemon
    Right click on any *.ovpn file in the Windows 10 File Explorer.
    Select "Open with" and then "Choose another app".
    Select [x] Always use this app to open *.ovpn files
    Change from: *.ovpn starts with the OpenVPN GUI (openvpnserv.exe)
    Change to:   *.ovpn starts with the OpenVPN Daemon (openvpn.exe)

B. Set the executable permissions for OpenVPN/bin/*.exe to run as admin.
    Rightclick on openvpn.exe > Properties > Compatibility > 
    [x]Run this program as an administrator 
       [Change settings for all users]
    [x]Run this program as an administrator
       [OK][OK]

C. Add a Windows 10 32-bit DWORD to open more than 15 files at a time.
    HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer
    Name : MultipleInvokePromptMinimum
    Type : DWORD
    Default : 15 (decimal)
    Change to: 200 (decimal)

D. Set OpenVPN Daemon running logs to open up in the same spot!
    Doubleclick on an *.ovpn file to open up the OpenVPN Daemon log
    Right click in the top bar of that running log file
    Select "Properties" & go to the "Layout" tab
    Position the window as you want all of the windows to appear
    Uncheck the checkbox for "[ ]Let system position window"
    Press OK

   Be careful if that spot is a second screen as you won't be able
   to see open VPN windows when/if you disconnect that second screen.

E. Optionally bypass UAC which otherwise pop up when an *ovpn is run
   by adding a shortcut that calls the task scheduler which calls the
   executable "with highest privileges".

   Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\vpnopen.exe
   This allows "Win+R > vpnopen" to work.

   C:\pathto\link\vpnopen.lnk
    TARGET=C:\Windows\System32\schtasks.exe /run /TN "task:vpnopen"
    STARTIN=%windir%\system32
    COMMENT=taskschd.msc > Task Scheduler Library > task:vpnopen> 
    General > [x]Run with highest privileges
    Actions > Start a program > Program/script > %comspec%
    Add arguments > /c start "" c:\pathto\openvpn.exe c:\pathto\configs\openvpn.ovpn

   Optionally, if you keep UAC, you could change the sound (if desired):
    From: C:\Windows\Media\Windows User Account Control.wav
    To: C:\Windows\Media\ding.wav
    Control Panel -> Hardware and Sound -> Sound -> Change system sounds
    Sounds -> Windows User Account Control -> 
    Browse -> C:\Windows\Media\ding.wav -> Test -> Apply -> OK

2. Download any number of free openvpn configuration files 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
   (other countries and protocols exist at that web site)

   Here is another common free set of openvpn configuration files
   (where the login/password credentials are embedded in the file):
   https://vanwa.tech/vpn 
   https://vanwa.tech/free-openvpn-service
   https://vanwa.tech/download-free-openvpn-config

   And many others (many don't even require a change of login/password):
   https://www.vpngate.net/en/
   
   For our example, we'll use this particular free openvpn config file:
   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 each approach based on the specific 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 where 
   you will need to update that password file when it changes.

4. Then I'd modify the config file to find that login/password file:
   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 at 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

   Or, you can just doubleclick on the freeopenvpn.config file if you've
   set up the "ovpn" file associations to run the openvpn client daemon 
   (openvpn.exe) instead of the openvpn client GUI (abc).

   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. The steps are similar for vanwa.tech (but 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, there are many freely available openvpn configuration files 
on the net, all of which work with the FOSS openvpn client. Each works 
slightly differently though in what they require for authentication.

And that is what we're dealing with here, in addition to being 
able to run any number of these files at will.

As always, please improve.
(for example if you know of other free openvpn config file repos)

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | alt.comp.microsoft.windows


csiph-web