@echo off REM Set active directory to the folder where this script is located cd /d %~dp0 REM Set these variables set OLDVER=8.7.1 set FILES=ExtMirr.sys REM Make sure the files exist. for %%f in (%FILES%) do ( if not exist %%f ( set ERRMSG=Error: %%f does not exist in the patch folder. goto :Error ) ) REM ---------- REM VERIFY ENV REM ---------- echo Verifying current DataKeeper version reg query "HKLM\SOFTWARE\Wow6432Node\SteelEye\Extended Mirroring" /v Version | findstr %OLDVER% > NUL: if not %errorlevel%==0 ( set ERRMSG=Error: SIOS DataKeeper version is not %OLDVER% goto Error ) REM --------- REM INSTALL REM --------- timeout /t 2 > NUL: 2>&1 echo. echo Install ExtMirr.sys at %WINDIR%\System32\drivers. REM If a previous patch already saved ExtMirr.sys-%OLDVER% don't do it here if not exist "%WINDIR%\System32\drivers\ExtMirr.sys-%OLDVER%" ( move /y "%WINDIR%\System32\drivers\ExtMirr.sys" "%WINDIR%\System32\drivers\ExtMirr.sys-%OLDVER%" > NUL: 2>&1 if not %errorlevel%==0 ( set ERRMSG=Error: Unable to save current ExtMirr.sys driver as ExtMirr.sys-%OLDVER% goto Error ) ) else ( REM We need to move ExtMirr.sys because a process sometimes has a handle REM open on it. And not necessarily Event Viewer - sometimes we have REM a svchost.exe with a handle, which we can't control. move /y "%WINDIR%\System32\drivers\ExtMirr.sys" "%WINDIR%\System32\drivers\ExtMirr.delete" > NUL: 2>&1 ) copy /y ExtMirr.sys "%WINDIR%\System32\drivers" > NUL: 2>&1 if not %errorlevel%==0 ( set ERRMSG=Error: Unable to install ExtMirr.sys driver to "%WINDIR%\System32\drivers". If Event Viewer is running on this system then exit from Event Viewer and install again. goto Error ) timeout /t 2 > NUL: 2>&1 echo. echo Successfully installed ExtMirr.sys REM --------- REM SUCCESS REM --------- echo. echo SUCCESSFUL INSTALLATION OF PATCH FILES. echo. echo Reboot this system to complete the installation process. echo. echo. pause exit /b 0 REM -------------- REM Error handling REM -------------- :Error echo %ERRMSG% echo Installation terminating. echo. echo. pause exit /b 1