Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Biology grows on you.


computers / alt.comp.os.windows-10 / Re: Why Windows 10 batch admin isn't the same as its GUI admin?

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

<shkojr$1nm9$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=55333&group=alt.comp.os.windows-10#55333

  copy link   Newsgroups: alt.comp.os.windows-10 alt.comp.microsoft.windows alt.msdos.batch
Path: i2pn2.org!i2pn.org!aioe.org!byfYGra9UYTu3eUW2DIdpA.user.46.165.242.75.POSTED!not-for-mail
From: scott@slp53.sl.home (Scott Lurndal)
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: Sun, 12 Sep 2021 14:34:22 +0300
Organization: UsenetServer - www.usenetserver.com
Message-ID: <shkojr$1nm9$1@gioia.aioe.org>
References: <she5mh$17nl$1@gioia.aioe.org> <iq5vbeF2hu1U1@mid.individual.net>
Reply-To: slp53@pacbell.net
Injection-Info: gioia.aioe.org; logging-data="57033"; posting-host="byfYGra9UYTu3eUW2DIdpA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
X-newsreader: xrn 9.03-beta-14-64bit
 by: Scott Lurndal - Sun, 12 Sep 2021 11:34 UTC

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)

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

By: Scott Lurndal on Thu, 9 Sep 2021

29Scott Lurndal
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor