Mapping a network drive when vpn client connects



  • Trying to make the openvpn client map a network drive as part of the startup.

    Tried the a suggested method of making a batch file named "name of conifg_up.bat".
    In that batch file I call another batch file like this "start mapkdrive.bat"
    It runs the mapkdrive.bat file.
    Opens a dos window.
    maps the drive and the window stays open.
    In that window I can access the mapped drive.
    but outside that window I can't.
    The window is running as administrator.
    if I close the window the drive map is gone.

    Trying make this simple for some very simple minded users.
    Having a desktop icon that they can just click on and it runs the vpn client then map the drive would be fantastic.

    Did several searches but cant find anything that works.



  • The window is running as administrator.
    if I close the window the drive map is gone.

    that is the problem …. windows drive-maps are generally user-sensitive. a 'net use" running as administrator will not show up on the users 'my computer'.
    if you are running a AD/DC you could just use gpo's to map the drives. run a 'gpupdate /force' upon start of openvpn



  • Not running AD/DC.

    Any other suggestions?



  • There is a Windows policy EnableLinkedConnections - that allows a normal user process and an elevated process to share drive letter mappings.
    But I suspect that in your case, the elevated process being an OpenVPN service thing and not an elevated copy of the user, that the mappings may not get shared anyway.



  • @phil.davis:

    There is a Windows policy EnableLinkedConnections - that allows a normal user process and an elevated process to share drive letter mappings.
    But I suspect that in your case, the elevated process being an OpenVPN service thing and not an elevated copy of the user, that the mappings may not get shared anyway.

    That seems to have worked.
    Did not test it much yet.

    Not a pretty way to do something very simple.



  • It is a shame that Windows does not have a concept of adding a drive letter mapping for a share that is available system-wide ("net use /systemwide" command). It is happy to let an administrator define drive letters for the real partitions on the local disks, and those are seen by all users, so it couldn't be that difficult to allow the same for network shares.


Log in to reply