@echo off
color 0B
title School App Detector & Guide
cls

echo ========================================================
echo      Scanning System for Monitoring Software...
echo ========================================================
echo.

:: Initialize flags to 0 (Not found)
set "ABFound=0"
set "LanFound=0"
set "NetFound=0"
set "GoFound=0"
set "ImpFound=0"
set "LightFound=0"

:: ---------------------------------------------------------
:: 1. SCANNING FOR AB TUTOR
:: ---------------------------------------------------------
tasklist /FI "IMAGENAME eq ABClient.exe" 2>NUL | find /I "ABClient.exe" >NUL
if "%ERRORLEVEL%"=="0" set "ABFound=1"
if exist "C:\Program Files\ABTutor" set "ABFound=1"
if exist "C:\Program Files (x86)\ABTutor" set "ABFound=1"

if "%ABFound%"=="1" echo [DETECTED] AB Tutor

:: ---------------------------------------------------------
:: 2. SCANNING FOR LANSCHOOL
:: ---------------------------------------------------------
tasklist /FI "IMAGENAME eq student.exe" 2>NUL | find /I "student.exe" >NUL
if "%ERRORLEVEL%"=="0" set "LanFound=1"
if exist "C:\Program Files\LanSchool" set "LanFound=1"
if exist "C:\Program Files (x86)\LanSchool" set "LanFound=1"

if "%LanFound%"=="1" echo [DETECTED] LanSchool

:: ---------------------------------------------------------
:: 3. SCANNING FOR NETSUPPORT SCHOOL
:: ---------------------------------------------------------
tasklist /FI "IMAGENAME eq client32.exe" 2>NUL | find /I "client32.exe" >NUL
if "%ERRORLEVEL%"=="0" set "NetFound=1"
if exist "C:\Program Files\NetSupport\NetSupport School" set "NetFound=1"

if "%NetFound%"=="1" echo [DETECTED] NetSupport School

:: ---------------------------------------------------------
:: 4. SCANNING FOR GO GUARDIAN
:: ---------------------------------------------------------
:: GoGuardian is mostly a Chrome extension, but we check for the rare Windows app
if exist "C:\Program Files\GoGuardian" set "GoFound=1"
:: We also check if Chrome is running, as that is where GoGuardian usually lives
tasklist /FI "IMAGENAME eq chrome.exe" 2>NUL | find /I "chrome.exe" >NUL
if "%ERRORLEVEL%"=="0" set "GoFound=2"

if "%GoFound%"=="1" echo [DETECTED] GoGuardian (Windows App)
if "%GoFound%"=="2" echo [DETECTED] Chrome is running (Potential GoGuardian Extension)

:: ---------------------------------------------------------
:: 5. SCANNING FOR IMPERO
:: ---------------------------------------------------------
tasklist /FI "IMAGENAME eq ImperoClient.exe" 2>NUL | find /I "ImperoClient.exe" >NUL
if "%ERRORLEVEL%"=="0" set "ImpFound=1"
if exist "C:\Program Files\Impero Solutions" set "ImpFound=1"

if "%ImpFound%"=="1" echo [DETECTED] Impero Education Pro

:: ---------------------------------------------------------
:: 6. SCANNING FOR LIGHTSPEED
:: ---------------------------------------------------------
tasklist /FI "IMAGENAME eq LSSASvc.exe" 2>NUL | find /I "LSSASvc.exe" >NUL
if "%ERRORLEVEL%"=="0" set "LightFound=1"

if "%LightFound%"=="1" echo [DETECTED] Lightspeed Systems Agent

echo.
echo Scan Complete. Generating instructions...
echo ========================================================
echo.

:: ---------------------------------------------------------
:: INSTRUCTIONS SECTION
:: ---------------------------------------------------------

if "%ABFound%"=="1" (
    echo [INSTRUCTIONS FOR AB TUTOR]
    echo 1. Open Control Panel via the Start Menu.
    echo 2. Go to "Programs and Features".
    echo 3. Look for "AB Tutor Client" or "AB Tutor Student".
    echo 4. Right-click and select "Uninstall".
    echo NOTE: If it asks for a password, you will need the admin password.
    echo       Sometimes, booting into Safe Mode allows you to delete the folder
    echo       at C:\Program Files\ABTutor manually.
    echo --------------------------------------------------------
)

if "%LanFound%"=="1" (
    echo [INSTRUCTIONS FOR LANSCHOOL]
    echo 1. LanSchool is difficult to remove without an MSI file.
    echo 2. Try going to Settings > Apps > Installed Apps.
    echo 3. Locate "LanSchool Student".
    echo 4. Click Uninstall.
    echo TRICK: If you disconnect your WiFi, LanSchool cannot talk to the teacher
    echo        console, essentially disabling it temporarily.
    echo --------------------------------------------------------
)

if "%NetFound%"=="1" (
    echo [INSTRUCTIONS FOR NETSUPPORT]
    echo 1. Open Control Panel > Programs and Features.
    echo 2. Find "NetSupport School".
    echo 3. Uninstall it.
    echo NOTE: NetSupport often runs a service called "Client32".
    echo       If you have Admin rights, run "services.msc", find "Client32",
    echo       Right-click > Stop, then Right-click > Properties > Disable.
    echo --------------------------------------------------------
)

if "%GoFound%"=="2" (
    echo [INSTRUCTIONS FOR GO GUARDIAN / CHROME EXTENSIONS]
    echo GoGuardian is usually a Browser Extension, not a standalone app.
    echo 1. Open Chrome.
    echo 2. Type "chrome://extensions" in the top bar and hit Enter.
    echo 3. Look for the "GoGuardian" icon.
    echo 4. If the "Remove" button is visible, click it.
    echo 5. If it says "Managed by your organization" (Icon of a building),
    echo    you cannot remove it while signed into that school account.
    echo WORKAROUND: Sign out of the school account and use a personal Guest account.
    echo --------------------------------------------------------
)

if "%ImpFound%"=="1" (
    echo [INSTRUCTIONS FOR IMPERO]
    echo 1. Impero protects itself aggressively.
    echo 2. Open Task Manager (Ctrl+Shift+Esc).
    echo 3. Go to the "Details" tab.
    echo 4. Look for "ImperoClient.exe".
    echo 5. Right-click > End Task. (It may restart immediately).
    echo 6. To uninstall, you must use Control Panel > Programs and Features.
    echo --------------------------------------------------------
)

if "%LightFound%"=="1" (
    echo [INSTRUCTIONS FOR LIGHTSPEED SYSTEMS]
    echo 1. This runs as a background service called "LSSASvc.exe".
    echo 2. Press Windows Key + R, type "services.msc" and hit Enter.
    echo 3. Look for "Lightspeed" or "Smart Agent" in the list.
    echo 4. Double click it -> Change Startup type to "Disabled".
    echo 5. Click "Stop" and then "OK".
    echo --------------------------------------------------------
)

if "%ABFound%%LanFound%%NetFound%%GoFound%%ImpFound%%LightFound%"=="000000" (
    echo No specific classroom monitoring apps were found.
    echo Please check "Add or Remove Programs" manually to be sure.
)

pause