::echo is currently enabled to allow debugging @echo off cls ::::::::::::::::::::::::::::::::::::::: :: GET THE DATE AND TIME FOR LOGGING :: ::::::::::::::::::::::::::::::::::::::: :: Set isodate using less reliable regional data Set _isodate=%date:~10,4%-%date:~7,2%-%date:~4,2%T%time:~0,2%%time:~3,2% :: If WMIC is available, try to get isodate using that. Else, just skip WMIC.EXE Alias /? >NUL 2>&1 || GOTO s_skip :: Get date and time for storing in log FOR /F "skip=1 tokens=1-6" %%G IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO ( IF "%%~L"=="" goto s_datedone Set _yyyy=%%L Set _mm=00%%J Set _dd=00%%G Set _hour=00%%H SET _minute=00%%I ) :: ESCAPE from the previous loop :s_datedone :: Pad digits with leading zeros Set _mm=%_mm:~-2% Set _dd=%_dd:~-2% Set _hour=%_hour:~-2% Set _minute=%_minute:~-2% :: Set _ the date/time in ISO 8601 format: Set _isodate=%_yyyy%-%_mm%-%_dd%T%_hour%%_minute% :s_skip md %TEMP%\Drive_Map Set _log=%TEMP%\Drive_Map\%_isodate%.log echo %_log% set _state=down for /f "tokens=5,7" %%a in ('ping -n 1 172.30.124.104') do ( if "x%%a"=="xReceived" if "x%%b"=="x1," set _state=up ) echo Your connection to Purdue is %_state% >>"%_log%" ( echo %Time% on %Date% echo Link is %_state% ) :: GOTO s_linkdown if the link is down if "%_state%"=="down" GOTO s_linkdown :: Log the list of current authentication tokens, then old mapped drives >>"%_log%" ( echo. echo. cmdkey.exe /list echo. echo. echo. echo. echo. echo Old mapped drives net use ) echo. echo. echo This script will help you get connected to the network echo drives for SIA if you are on an off-domain laptop. Do not echo use if you are on an ECN domain (ECN managed) computer. set /p _user="Please enter your Purdue career account username:" echo. echo Enter your password when it is requested echo (it will probably be requested multiple times) echo. echo. net use U: /delete /yes net use W: /delete /yes net use Y: /delete /yes net use U: \\techstor1.ecn.purdue.edu\%_user% /USER:ecn\%_user% net use W: \\myhome.itap.purdue.edu\myhome\%_user% /USER:onepurdue\%_user% net use Y: \\techwin.ecn.purdue.edu\site /USER:ecn\%_user% cmd /c net use \\ecnprint04.itap.purdue.edu\ipc$ /USER:onepurdue\%_user% cmd /c net use \\ecnprint08.itap.purdue.edu\ipc$ /USER:onepurdue\%_user% cls echo Next, the print servers will be brought up. Please echo double-click on any network printers you need to connect to. echo Then, close the windows with lists of printers. echo. echo Press any key to continue. pause start \\ecnprint08.itap.purdue.edu\ GOTO s_quit cls :: Notify the user that the link is down :s_linkdown echo. echo. echo The computer cannot reach Purdue servers. echo You might need to check your connection. echo. echo If you have an internet connection, you might need echo to use a Purdue Virtual Private Network (VPN). echo Instructions are at http://eng.purdue.edu/jump/141f6a1 echo or at http://eng.purdue.edu/jump/9cceb5 echo. :s_quit >>"%_log%" ( echo. echo. echo Currently mapped drives (after the script is finished) net use echo. echo. ) echo If you need help, please use the form at echo purdue.edu/ecn/contactus and attach the most recent .log echo file in %TEMP%/Drive_Map echo. echo. echo Press any key to close this script pause