Here is the current batch:
@echo off
rasdial "OurCompany VPN" /domain:domain_name
if errorlevel 1 goto finish_error
net use P: \\10.0.0.1\share_name /persistent:no
if errorlevel 1 goto finish_nomap
goto finish_noerror
:finish_error
echo There was an error completing your connection.
pause
goto exit_batch
:finish_nomap
echo You have connected to the VPN, but the connection to the mapped drive
could not be completed.
pause
goto exit_batch
:finish_noerror
echo You have been successfully connected.
pause
:exit_batch
> I am using the RASDIAL command in a batch file for users to connect to our
> VPN, so it can also map the network drive. This works great, but I would
> like to see if it can check for a valid connection to the internet (IP
> address or other method) before executing the command, as I would like for
> this batch file to be added to startup. All of these users travel, and
> often work offline. Any suggestions or recommendations would be
> appreciated.
Hi
Ping an IP address and test for the text TTL.
Command line solutions:
ping.exe -n 1 IPAddressHere | find "TTL="
A VBScript version of the above:
http://groups.google.com/groups?selm=3EB2AA54.EBB5ECBC%40hydro.com
--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter
See tip 228 and links in the 'Tips & Tricks' at http://www.jsiinc.com
set connected=N
for /f "Tokens=*" %%c in ('ping -n 1 IPAddress ^| FIND "TTL"') do (
set connected=Y
)
If "%connected%" EQU "Y" goto connected
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com