Connecting Mapped Drives

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
jm_tim
OpenVpn Newbie
Posts: 11
Joined: Wed Dec 28, 2016 7:45 pm

Connecting Mapped Drives

Post by jm_tim » Thu May 18, 2017 5:49 pm

I am running OpenVPN Server on a Windows 10 machine and OpenVPN Client on a Windows 10 machine. I can map my drives fine with client once connected to server. However, I cannot see my mapped drives on the server computer. Here are some network details.

OpenVPN Server 192.168.20.1
OpenVPN Client 192.168.20.2
Local Windows 10 Machine where OpenVPN server is 192.168.0.200
Mapped Drive on Windows 10 machine that I cannot see with OpenVPN client is 192.168.0.2

Any help would be apprecaited or if you need more info, please let me know. Thank you in advance

w9smith
OpenVpn Newbie
Posts: 1
Joined: Wed Aug 22, 2018 2:56 am

Re: Connecting Mapped Drives

Post by w9smith » Wed Aug 22, 2018 2:59 am

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.

Post Reply