Page 1 of 1

Map Drives After Connecting

Posted: Wed Oct 24, 2018 3:15 pm
by foreignbishop
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 ;)

Re: Map Drives After Connecting

Posted: Wed Oct 24, 2018 3:55 pm
by Pippin
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.