@echo off
REM
REM This script is used to Enable or Disable Remote UI access for Intel Dynamic Tuning on Desktop Windows 
REM This script must be executed by a user with Administrator rights.
REM
REM Usage: setup-remoteui.cmd [ install / uninstall ]
REM
if /i [%1]==[install] goto install
if /i [%1]==[uninstall] goto uninstall
echo.
echo This script will configure the Intel(R) Dynamic Tuning Remote UI Feature on the current system.
echo A Reboot or Restart of DTT is Required after making this change.
echo This script must be run by a System Administrator.
echo.
if exist %WINDIR%\System32\drivers\DriverData\Intel\DPTF\dv\remoteui.dvx (
	echo *** The Remote UI Option is currently INSTALLED ***
) else (
	echo *** The Remote UI Option is currently UNINSTALLED ***
)
echo.
choice /C IUC /M "Do you want to (I)nstall or (U)ninstall the Remote UI Feature or (C)ancel?"
echo.
if errorlevel 3 goto :eof
if errorlevel 2 goto uninstall
if errorlevel 1 goto install
goto :eof

:install
echo Enabling Remote UI Access for DTT UI ...
copy /y %~dp0dv\remoteui.dvx %WINDIR%\System32\drivers\DriverData\Intel\DPTF\dv >nul
if NOT ERRORLEVEL 1 (echo Done) else (echo ERROR!)
if [%1]==[] (
	if ERRORLEVEL 1 (
		echo This script must be run by a System Administrator.
	) else (
		echo Restart the system for changes to take effect.
	)
	pause
)
goto :eof

:uninstall
echo Disabling Remote UI Access for DTT UI ...
del /f %WINDIR%\System32\drivers\DriverData\Intel\DPTF\dv\remoteui.dvx 2>nul >nul
if NOT ERRORLEVEL 1 (echo Done) else (echo ERROR!)
if [%1]==[] (
	if ERRORLEVEL 1 (
		echo This script must be run by a System Administrator.
	) else (
		echo Restart the system for changes to take effect.
	)
	pause
)
goto :eof
