@ECHO OFF
SETLOCAL

:: Check if the script is running as administrator
NET SESSION >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
    ECHO This script requires administrative privileges. Please run as Administrator.
    ECHO Requesting elevation...
    PowerShell -Command "Start-Process '%~0' -Verb RunAs"
    EXIT /B
)

:: Stop the service if it's running
echo Stopping the MIBService...
net stop MIBService

:: Delete the service
echo Deleting the MIBService...
sc delete MIBService

:: Optional: Clean up related files if required (example: deleting the executable)
:: ECHO Deleting the MIBService executable...
:: DEL /F /Q "%~dp0MIBService.exe"

echo ---------------------------------------------------
echo Service removed successfully.

:: Prevent the window from closing automatically
ENDLOCAL
EXIT
