I want to make a connection from my laptop to my server where I have my music library. I used
net use "\\SERVER\Folder\etc\" /SAVECRED /PERSISTENT:yes
to connect to my server. But I also want to be able to connect to the server when I'm not at home, so I've set up a VPN server where I can manually connect to.
Now I'd like to be able to connect to the server without having to check if the VPN is enabled and whether or not I need to use the VPN.
Can I make it so that when I try to connect to my server, it connects to the VPN if I'm not on LAN, otherwise it just connects over LAN without the VPN?
EDIT
For future reference, here's my final solution:
@echo off
ping -n 1 SERVER
if errorlevel 1 (
rasdial "Server VPN" "username" "supersecretpassword"
ping -n 1 SERVER
if errorlevel 1 (
echo msgbox "Could not establish connection to \\SERVER\" + vbCrLf + vbCrLf + "*sadface*" > %tmp%\tmpmsgbox.vbs
wscript %tmp%/tmpmsgbox.vbs
del %tmp%/tmpmsgbox.vbs
)
)