[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Web openvpn.net

Re: [Openvpn-users] Automatic MS network share mount

  • Subject: Re: [Openvpn-users] Automatic MS network share mount
  • From: Vladimír Benc <v.benc@xxxxxxxx>
  • Date: Wed, 4 Apr 2007 14:38:10 +0200

> I would like to automatically mount network shares from W2k3 server on
> windows client after successfully connect to my OpenVPN server.
> I've 2 batch files with a "net use" commands, and if i run it manually
> after I connect, all works fine, even a \\computername\share syntax
> are resolved trough a WINS. But if I put this scripts in config file
> "up" and "down" commands, this scripts are invoked BEFORE/AFTER the
> routes come up/down, so it doesn't work. No matter if use up-delay and
> pre-down .
> Any ideas ?

I resolved this by calling the .cmd scripts through "start" command,
so the script will "fork" and openvpn don't wait until the script
terminates and adding a sleep hack trough ping to wait about 10 seconds
before mounting a network share. (enough to bring TUN/TAP iface up and
routes added).

so from openvpn config:
up "start /MIN c:\\progra~1\\openvpn\\config\\scripts\\netdrive_up.cmd"

and the netdrive_up.cmd:

ping -n 10 -w 1000 > nul
net use x: \\compname\sharename pass /user:name@domain

This solution work, but is very ugly.

Everybody done it more cleanly ?

OpenVPN mailing lists