SOLVED
I needed a solution that was as user friendly as possible. IE: NO USER INTERACTION NEEDED
Setup
PC: Windows 10, build 1803, 32 bit. Running OpenVPN ver 2.4.6-I602.
Netgear router: Nighthawk R7000, VPN enabled
This setup is PC at satellite office needing to access network at main office (location of Netgear router).
ISSUE:
OpenVPN connects and is stable. But the xxx-up.bat and xxx-down.bat do not work on PC to connect or disconnect drive maps. I can manually map the drives after OpenVPN is connected. If I make the drive maps PERMANENT, Windows shows them disconnected and user must click on them to force Windows to see them as connected.
SOLUTION
I used SCHEDULE TASK to start OpenVPN with a 30 second delay when user logs into Windows.
see:
https://www.cactusvpn.com/tutorials/how ... n-windows/
Created BAT file that does the drive mapping, but only after the OpenVPN is connected.
Created a task in SCHEDULE TASK to run this bat file. This task is also a 30 delay start task like the one starting OpenVPN.
Contents of bat file:
@echo off
:: REM in case drive map left over from crash
If exist K:\nul net use K: /delete
:: REM wait until server access is available
cls
:LOOP1
netsh interface show interface | find "NETGEAR-VPN" | find /I "disconnected" > nul
:::: find disconnected returns 0. Not finding disconnected returns 1
if %errorlevel% == 1 goto END
echo.
echo. VPN not connected. Checking in 5 seconds . . .
timeout /t 5 /nobreak > nul
goto LOOP1
:END
echo.
echo. VPN connection is OK.
echo.
echo. Connecting K: drive drive now . . .
timeout /t 5 /nobreak > nul
:: REM Map the drive
net use K: \\192.168.1.2\sharename password /user:administrator /PERSISTENT:NO
:: REM allow time for user to see message
timeout /t 3 /nobreak > nul
I hope this helps someone else so they do not need to go though all the testing of OpenVPN before deciding to use an external solution.