diff --git a/service_diagnostics.bat b/service_diagnostics.bat new file mode 100644 index 0000000..7b0fa9f --- /dev/null +++ b/service_diagnostics.bat @@ -0,0 +1,131 @@ +@echo off +setlocal EnableDelayedExpansion + +:: Admin rights check +if "%1"=="admin" ( + echo Started with admin rights + cls +) else ( + echo Requesting admin rights... + powershell -Command "Start-Process 'cmd.exe' -ArgumentList '/c \"\"%~f0\" admin\"' -Verb RunAs" + exit /b +) + +:: AdguardSvc.exe +tasklist /FI "IMAGENAME eq AdguardSvc.exe" | find /I "AdguardSvc.exe" > nul +if !errorlevel!==0 ( + call :PrintRed "[X] Adguard process found. Adguard may cause problems with Discord" + call :PrintRed "https://github.com/Flowseal/zapret-discord-youtube/issues/417" +) else ( + call :PrintGreen "Adguard check passed" +) +echo: + +:: Killer +sc query | findstr /I "Killer" > nul +if !errorlevel!==0 ( + call :PrintRed "[X] Killer services found. Killer conflicts with zapret" + call :PrintRed "https://github.com/Flowseal/zapret-discord-youtube/issues/2512#issuecomment-2821119513" +) else ( + call :PrintGreen "Killer check passed" +) +echo: + +:: Check Point +sc query | findstr /I "Check" | findstr /I "Point" > nul +if !errorlevel!==0 ( + call :PrintRed "[X] Check Point services found. Check Point conflicts with zapret" + call :PrintRed "Try to uninstall Check Point" +) else ( + call :PrintGreen "Check Point check passed" +) +echo: + +:: SmartByte +sc query | findstr /I "SmartByte" > nul +if !errorlevel!==0 ( + call :PrintRed "[X] SmartByte services found. SmartByte conflicts with zapret" + call :PrintRed "Try to uninstall or disable SmartByte through services.msc" +) else ( + call :PrintGreen "SmartByte check passed" +) +echo: + +:: VPN +sc query | findstr /I "VPN" > nul +if !errorlevel!==0 ( + call :PrintYellow "[?] Some VPN services found. Some VPNs can conflict with zapret" + call :PrintYellow "Make sure that all VPNs are disabled" +) else ( + call :PrintGreen "VPN check passed" +) +echo: + +:: DNS +set "dnsfound=0" +for /f "skip=1 tokens=*" %%a in ('wmic nicconfig where "IPEnabled=true" get DNSServerSearchOrder /format:table') do ( + echo %%a | findstr /i "192.168." >nul + if !errorlevel!==0 ( + set "dnsfound=1" + ) +) +if !dnsfound!==1 ( + call :PrintYellow "[?] DNS servers are probably not specified." + call :PrintYellow "Provider's DNS servers are automatically used, which may affect zapret. It is recommended to install well-known DNS servers and setup DoH" +) else ( + call :PrintGreen "DNS check passed" +) +echo: + +:: Discord cache clearing +echo Do you want to clear the Discord cache? (Y/N) (default: Y) +set /p answer= +if "%answer%"=="" set answer=Y +if "%answer%"=="y" set answer=Y + +if /i "%answer%"=="Y" ( + tasklist /FI "IMAGENAME eq Discord.exe" | findstr /I "Discord.exe" > nul + if !errorlevel!==0 ( + echo Discord is running, closing... + taskkill /IM Discord.exe /F > nul + if !errorlevel! == 0 ( + call :PrintGreen "Discord was successfully closed" + ) else ( + call :PrintRed "Unable to close Discord" + ) + ) + + set "discordCacheDir=%appdata%\discord" + + for %%d in ("Cache" "Code Cache" "GPUCache") do ( + set "dirPath=!discordCacheDir!\%%~d" + if exist "!dirPath!" ( + rd /s /q "!dirPath!" + if !errorlevel!==0 ( + call :PrintGreen "Successfully deleted !dirPath!" + ) else ( + call :PrintRed "Failed to delete !dirPath!" + ) + ) else ( + call :PrintRed "!dirPath! does not exist" + ) + ) +) +echo: + +pause +exit /b + +:: Utility functions + +:PrintGreen +powershell -Command "Write-Host \"%~1\" -ForegroundColor Green" +exit /b + +:PrintRed +powershell -Command "Write-Host \"%~1\" -ForegroundColor Red" +exit /b + +:PrintYellow +powershell -Command "Write-Host \"%~1\" -ForegroundColor Yellow" +exit /b \ No newline at end of file