Automatic map network drive when connect on Windows.

OpenVPN tutorials ranging from configuration to hacks to compilation will be posted here.

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

Post Reply
300000
OpenVPN Expert
Posts: 685
Joined: Tue May 01, 2012 9:30 pm

Automatic map network drive when connect on Windows.

Post by 300000 » Tue Jul 13, 2021 9:44 pm

As people know that after update openvpn to 2.5 and windows update to 21H1 everything just stop work . then this is a trick to make only windows can automatic map a network drive when you connect to openvpn server. Mapping a network drive over VPN is main use for VPN and there are a lot use that , but making it work requite some time and some know how to . if some one dont know how it work it is quite hard to do for them so this is all will be done .

going to config folder and create a bat file name as your connection file with _up as picture

Image

open ddwrt_up.bat and add this line into it.

Code: Select all

@echo off
start  drive.bat
EXIT
the main job this file do is start other script file to run . as openvpn 2.5 there is no data transfer between server and client so we need the first script finish then openvpn can get ip and transfer data over tunnel.

now open you drive.bat and edit as follow.

Code: Select all

timeout /t 3
net use N: \\nha.thuctap1.com\nha  /user:root raspberry /PERSISTENT:YES
timeout /t 5 /nobreak > nul
because windows update make thing more trouble so you need to add this line to make it work . click search and type cmd right click and choose open with administrator

Code: Select all

reg add  HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System  /v EnableLinkedConnections  /t REG_DWORD  /d 1 /f

after that you need restart computer to make it work for you.
Last edited by 300000 on Tue Jul 13, 2021 9:47 pm, edited 1 time in total.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Automatic map network drive when connect on Windows.

Post by TinCanTech » Tue Jul 13, 2021 9:47 pm

Moved to Tutorials. 8-)

Post Reply