-
-
Save arjankuijpers/b1406118ee5c48f5ebdcbd31fb72f354 to your computer and use it in GitHub Desktop.
A batch file to connect to the VPN and mount the network storage as a drive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
if exist n:\home goto DISCONNECTME else goto CONNECTME | |
:CONNECTME | |
REM NOTE: in all of the below variables EXCEPT for mydrivename , double-quote the values! | |
REM This is the name of the VPN you've got set up | |
set myvpnname="Name of your VPN connection" | |
REM Your LDAP username and password | |
set myusername="username" | |
set mypassword="password" | |
REM The name of your CIFS instance, to use for mapping the drive | |
REM -- DO NOT QUOTE THIS VALUE! | |
set mydrivename=cifs##.bravo | |
rasdial %myvpnname% %myusername% %mypassword% | |
timeout 4 | |
net use n: "\\%mydrivename%\public" %mypassword% /user:%myusername% /persistent:no | |
goto DONE | |
:DISCONNECTME | |
net use n: /delete | |
timeout 2 | |
rasdial %myvpnname% /d | |
goto DONE | |
:DONE | |
@echo on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment