Map Drives After Connecting

Business solution to host your own OpenVPN server with web management interface and bundled clients.
Post Reply
foreignbishop
OpenVpn Newbie
Posts: 1
Joined: Wed Oct 24, 2018 3:13 pm

Map Drives After Connecting

Post by foreignbishop » Wed Oct 24, 2018 3:15 pm

Perhaps I'm blind, but can someone point me in the direction to assist with finding out where to place batch files with commands to map drives after successfully connecting? I've seen some older articles but that's 7 years ago and I'm currently on version 2.5.x. I'm familiar with the process using netextender or anyconnect but w/OpenVPN is new to me. Appreciate any guidance ;)

User avatar
Pippin
Forum Team
Posts: 1200
Joined: Wed Jul 01, 2015 8:03 am
Location: irc://irc.libera.chat:6697/openvpn

Re: Map Drives After Connecting

Post by Pippin » Wed Oct 24, 2018 3:55 pm

Make a batch, client_up.bat, adjust to your need:

Code: Select all

net use Y: \\192.168.160.1\share1 /user:username password
net use Z: \\192.168.160.1\share2
Where client is the name of the config file.

Make another batch, down.bat:

Code: Select all

net use /delete Y:
net use /delete Z:
Place both in config folder of OpenVPN.

Add to client.ovpn:

Code: Select all

script-security 2
down "c:\\Users\\<USERNAME>\\OpenVPN\\config\\down.bat"
or

Code: Select all

script-security 2
down "c:\\Program Files\\OpenVPN\\config\\down.bat"
depending where your config file is.

Post Reply