189 lines
5.4 KiB
Batchfile
189 lines
5.4 KiB
Batchfile
@echo off
|
|
chcp 65001 >nul
|
|
title Kill-Telemetry
|
|
color 0A
|
|
|
|
:: ============================================================
|
|
:: Kill-Telemetry.bat
|
|
:: One-click kill Windows telemetry
|
|
::
|
|
:: Blocks telemetry domains, disables telemetry services,
|
|
:: and removes telemetry components.
|
|
::
|
|
:: Requires: Windows 10/11, Administrator privileges
|
|
:: Optional: NSudo (for file-level blocking)
|
|
:: ============================================================
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
:: Check for administrator privileges
|
|
net session >nul 2>&1
|
|
if %errorLevel% neq 0 (
|
|
echo [ERROR] Administrator privileges required.
|
|
echo Please right-click this file and select "Run as administrator".
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo ============================================================
|
|
echo Kill-Telemetry - Disable Windows Telemetry
|
|
echo ============================================================
|
|
echo.
|
|
|
|
echo [*] Starting telemetry blocking...
|
|
echo [*] Three layers: hosts + services + files
|
|
echo.
|
|
|
|
echo ============================================================
|
|
echo [STEP 1/3] Block telemetry domains via hosts
|
|
echo ============================================================
|
|
echo.
|
|
|
|
set HOSTS=%SystemRoot%\System32\drivers\etc\hosts
|
|
|
|
:: Backup hosts
|
|
copy /y %HOSTS% %HOSTS%.bak >nul 2>&1
|
|
echo [OK] hosts backed up to %HOSTS%.bak
|
|
|
|
:: Telemetry and tracking domains
|
|
set BLOCK_DOMAINS=^
|
|
browser.events.data.msn.cn ^
|
|
functional.events.data.microsoft.com ^
|
|
vortex.data.microsoft.com ^
|
|
settings-win.data.microsoft.com ^
|
|
watson.telemetry.microsoft.com ^
|
|
telemetry.microsoft.com ^
|
|
oca.telemetry.microsoft.com ^
|
|
onecollector.microsoft.com ^
|
|
msedge.api.cdp.microsoft.com ^
|
|
edge.microsoft.com ^
|
|
rewards.bing.com ^
|
|
prod.rewardsplatform.microsoft.com ^
|
|
substrate.office.com ^
|
|
graph.microsoft.com ^
|
|
nav-edge.smartscreen.microsoft.com ^
|
|
c.msn.cn ^
|
|
assets.msn.cn ^
|
|
ntp.msn.cn ^
|
|
edge-consumer-static.azureedge.net ^
|
|
login.live.com ^
|
|
storage.live.com ^
|
|
clarity.ms ^
|
|
www.clarity.ms ^
|
|
n.clarity.ms ^
|
|
j.clarity.ms ^
|
|
c.clarity.ms ^
|
|
sb.scorecardresearch.com ^
|
|
scorecardresearch.com ^
|
|
countly.mail.163.com ^
|
|
b.mail.163.com ^
|
|
dl.reg.163.com ^
|
|
passport-sym3.netease.com ^
|
|
gator.volces.com ^
|
|
tab.volces.com ^
|
|
apmplus.volces.com ^
|
|
lf3-data.volccdn.com ^
|
|
lf3-static.bytednsdoc.com ^
|
|
beacon.qq.com ^
|
|
otheve.beacon.qq.com ^
|
|
hm.baidu.com ^
|
|
pos.baidu.com ^
|
|
tongji.baidu.com ^
|
|
google-analytics.com ^
|
|
ssl.google-analytics.com ^
|
|
googletagmanager.com ^
|
|
doubleclick.net ^
|
|
ad.doubleclick.net ^
|
|
pagead2.googlesyndication.com
|
|
|
|
echo Writing hosts block rules...
|
|
|
|
(
|
|
echo # Kill-Telemetry - Blocked Domains
|
|
echo # Generated by Kill-Telemetry.bat
|
|
echo.
|
|
for %%d in (%BLOCK_DOMAINS%) do (
|
|
echo 0.0.0.0 %%d
|
|
echo 0.0.0.0 www.%%d
|
|
)
|
|
) >> %HOSTS%
|
|
|
|
echo [OK] hosts block rules added
|
|
|
|
:: Flush DNS
|
|
ipconfig /flushdns >nul 2>&1
|
|
echo [OK] DNS cache flushed
|
|
echo.
|
|
|
|
echo ============================================================
|
|
echo [STEP 2/3] Disable telemetry services
|
|
echo ============================================================
|
|
echo.
|
|
|
|
:: Stop and disable telemetry services
|
|
for %%s in (
|
|
"DiagTrack"
|
|
"dmwappushservice"
|
|
"WerSvc"
|
|
"wercplsupport"
|
|
"ConsentUxUserSvc"
|
|
) do (
|
|
sc stop %%s >nul 2>&1
|
|
sc config %%s start= disabled >nul 2>&1
|
|
echo [OK] %%s disabled
|
|
)
|
|
|
|
:: Set telemetry policy to 0 (disabled)
|
|
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f >nul 2>&1
|
|
echo [OK] AllowTelemetry=0 set
|
|
echo.
|
|
|
|
echo ============================================================
|
|
echo [STEP 3/3] Remove telemetry files (requires NSudo)
|
|
echo ============================================================
|
|
echo.
|
|
|
|
:: Check NSudo
|
|
set NSUDO=D:\NSUDO\NSudoLC.exe
|
|
if exist "%NSUDO%" (
|
|
echo [*] NSudo found, blocking telemetry files with SYSTEM privileges...
|
|
|
|
"%NSUDO%" -S cmd /c "cd /d C:\Windows\System32 && ren diagtrack.dll diagtrack.dll.BLOCKED" >nul 2>&1
|
|
echo [OK] diagtrack.dll blocked
|
|
|
|
"%NSUDO%" -S cmd /c "cd /d C:\Windows\System32 && ren utcapi.dll utcapi.dll.BLOCKED" >nul 2>&1
|
|
echo [OK] utcapi.dll blocked
|
|
|
|
"%NSUDO%" -S cmd /c "cd /d C:\Windows\System32 && ren utcutil.dll utcutil.dll.BLOCKED" >nul 2>&1
|
|
echo [OK] utcutil.dll blocked
|
|
|
|
"%NSUDO%" -S cmd /c "cd /d C:\Windows\System32 && ren UtcDecoderHost.exe UtcDecoderHost.exe.BLOCKED" >nul 2>&1
|
|
echo [OK] UtcDecoderHost.exe blocked
|
|
|
|
"%NSUDO%" -S cmd /c "cd /d C:\Windows\System32 && ren CompatTelRunner.exe CompatTelRunner.exe.BLOCKED" >nul 2>&1
|
|
echo [OK] CompatTelRunner.exe blocked
|
|
|
|
"%NSUDO%" -S cmd /c "cd /d C:\Windows\System32 && ren DeviceCensus.exe DeviceCensus.exe.BLOCKED" >nul 2>&1
|
|
echo [OK] DeviceCensus.exe blocked
|
|
|
|
"%NSUDO%" -S cmd /c "cd /d C:\Windows\System32 && ren dmwappushsvc.dll dmwappushsvc.dll.BLOCKED" >nul 2>&1
|
|
echo [OK] dmwappushsvc.dll blocked
|
|
) else (
|
|
echo [WARNING] NSudo not found at D:\NSUDO\NSudoLC.exe
|
|
echo [WARNING] Skipping file-level blocking. hosts + services blocking is sufficient.
|
|
echo [WARNING] Download NSudo and place it at D:\NSUDO\ for full blocking.
|
|
)
|
|
echo.
|
|
|
|
echo ============================================================
|
|
echo Telemetry blocking complete.
|
|
echo Domains blocked, services disabled, files removed.
|
|
echo ============================================================
|
|
echo.
|
|
echo Repository:
|
|
echo https://github.com/dvs-dvsxt/Kill-Telemetry
|
|
echo https://git.dvscloud.net/dvs/Kill-Telemetry
|
|
echo.
|
|
pause |