Linuxkids Rotating Header Image

mapDriveIfServerAvailable.bat

@echo off
rem ----------------------------------------------------------------------------------
rem Author:            Andrew Blokzyl
rem Contact:           drew@linuxkids.com

rem Description:       This script checks for server connectivity, then maps the drive.
rem ----------------------------------------------------------------------------------

title Dentrix startup script...
color 0E

Echo Checking for server connection...
echo.
ping -n 2 fs1 | find /i "reply from 100.100.1.1" > NUL 2>&1

if %errorlevel% == 1 goto error
if not exist n: net use n: \\fs1\public /persistent:no /user:"YOUR USER" YOUR_PASSWORD | find /i "successfully" >  NUL 2>&1
if %errorlevel% == 1 goto ping
goto success

:error
echo I am sorry Doc, i was unable to connect you to the server. Please make sure
echo you are connected to the network in your office. Either via wireless, or a
echo wired connection.
echo.
pause
goto end

:ping
echo I was able to get a reply from the server (fs1), but was unable to map the
echo neccessary drives in order to run Dentrix. This should not happen, please contact
echo your systems administrator.
echo.
pause
goto end

:success
echo Connection to the server was successful. Launching Dentrix...
goto end

:end
pause

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>