@echo System restart is required after uninstallation
@pause


@set LOGFILE=%temp%\OFUuninstall.Log
@echo %time%:Starting the UnInstallation of Online Flash Update Utility >> %LOGFILE%

@echo.
@echo Uninstalling the drivers...
@echo %time%:Uninstalling the drivers >> %LOGFILE%
@echo.
if "%OFUOSVERSION%"=="2K0" goto done
@echo.
@echo %time%:Uninstalling the drivers >> %LOGFILE%
@echo.
DeviceSetup.exe -v remove *INT0800
@if %ERRORLEVEL% GEQ 0 goto imbuninstall
@echo %time%:UnInstallation of driver failed >> %LOGFILE%
@goto error
q
:imbuninstall
@echo.
@echo %time%:UnInstalling IMB driver >> %LOGFILE%
@echo.
DeviceSetup.exe -v remove *IMBDRV
goto ibsmuninstall
@echo %time%:UnInstallation of IMB driver Failed >> %LOGFILE%
goto error

:ibsmuninstall
if "%OFUOSVERSION%"=="2K0" goto done
@echo.
@echo %time%:Uninstalling the drivers >> %LOGFILE%
@echo.
DeviceSetup.exe -v remove *IntelUtilDeV
goto done
@if %ERRORLEVEL% GEQ 0 goto done
@echo %time%:UnInstallation of driver failed >> %LOGFILE%
@goto error

:done
@echo Deleting driver files
@echo %time%:Deleting driver files >> %LOGFILE%
del "%windir%\inf\flashud.inf" 2>NUL
rmdir /s /q enus 
del /q *.* 2>NUL
@echo Done!
@echo.
@echo %time%:Successfully Uninstalled the Online Flash Update Utility drivers >> %LOGFILE%
@echo *********************************************************************** >> %LOGFILE%
@echo Successfully Uninstalled the Online Flash Update Utility !
@echo PLEASE REBOOT the system for changes to take effect.
goto exit

:error
@echo.
@echo %time%:Error Uninstalling the Online Flash Update Utility drivers >> %LOGFILE%
@echo ***************************************************************** >> %LOGFILE%
@echo @@@@ Error Uninstalling the Online Flash Update Utility drivers @@@@
@echo.

:exit


