Last active
March 2, 2018 04:04
-
-
Save aaronsnoswell/1e0fa653c64bf4caabbe103e814e963e to your computer and use it in GitHub Desktop.
Toggles a VPN, then does some other things (e.g. mount / unmount network drives)
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 | |
:: Toggles a VPN connection and does some other things | |
:: [e.g. connect/disconnect shared drives] | |
:: To set up a new VPN: type "rasphone /a" in the Run dialog [Win+R] | |
set vpn_name="EAIT VPN Connection" | |
ipconfig | find /i %vpn_name% && ( | |
:: Disconnect VPN | |
net use G: /delete | |
net use H: /delete | |
net use S: /delete | |
net use W: /delete | |
rasphone -h %vpn_name% | |
) || ( | |
:: Connect VPN | |
rasphone -d %vpn_name% && ( | |
net use H: \\smoke.eait.uq.edu.au\uqasnosw | |
net use S: \\smoke.eait.uq.edu.au\software | |
net use W: \\smoke.eait.uq.edu.au\web | |
net use G: \\smoke.eait.uq.edu.au\groups && ( | |
:: If G drive is successfully mounted, run a backup | |
echo "Backing up PhD files..." | |
"C:\Program Files\FreeFileSync\FreeFileSync.exe" "E:\ITEE G drive SyncSettings.ffs_batch" | |
if errorlevel 1 ( | |
echo "Errors occurred during backup. Please see C:\Users\uqasnosw\AppData\Roaming\FreeFileSync\LastSyncs.log" | |
pause | |
) else ( | |
echo "Backup succeeded" | |
) | |
) || ( | |
echo "G drive not mounted - backup will not run" | |
pause | |
) | |
) | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can add this to your windows 10 taskbar, but it's a pain.