|
| 1 | +@echo off |
| 2 | +rem Display info and license |
| 3 | +color f0 |
| 4 | +echo Telemetry Kill Script 1.0.0 |
| 5 | +echo A tool for disabling Windows Telemetry (at least part of it). |
| 6 | +echo https://github.com/DavisNT/Telemetry-Kill-Script |
| 7 | +echo. |
| 8 | +echo Copyright (c) 2017 Davis Mosenkovs |
| 9 | +echo. |
| 10 | +echo Permission is hereby granted, free of charge, to any person obtaining a copy |
| 11 | +echo of this software and associated documentation files (the "Software"), to deal |
| 12 | +echo in the Software without restriction, including without limitation the rights |
| 13 | +echo to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 14 | +echo copies of the Software, and to permit persons to whom the Software is |
| 15 | +echo furnished to do so, subject to the following conditions: |
| 16 | +echo. |
| 17 | +echo The above copyright notice and this permission notice shall be included in all |
| 18 | +echo copies or substantial portions of the Software. |
| 19 | +echo. |
| 20 | +echo THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 21 | +echo IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 22 | +echo FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 23 | +echo AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 24 | +echo LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 25 | +echo OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 26 | +echo SOFTWARE. |
| 27 | +echo. |
| 28 | +verify other 2>nul |
| 29 | +setlocal enableextensions |
| 30 | +if errorlevel 1 goto :end |
| 31 | +set accepted= |
| 32 | +if not "%1"=="/AUTO" if not "%1"=="/auto" set /P accepted=Press enter if you agree or immediately close this window otherwise! |
| 33 | +if not "%accepted%"=="" goto :end |
| 34 | +echo. |
| 35 | + |
| 36 | +rem Check admin rights |
| 37 | +net session >nul 2>nul |
| 38 | +if errorlevel 1 goto :noadmin |
| 39 | + |
| 40 | +rem Disable Telemetry |
| 41 | +set errors=0 |
| 42 | +echo Taking ownership of Telemetry files... |
| 43 | +takeown /A /F %SystemRoot%\system32\CompatTelRunner.exe |
| 44 | +if errorlevel 1 set errors=1 |
| 45 | +takeown /A /F %SystemRoot%\system32\GeneralTel.dll |
| 46 | +if errorlevel 1 set errors=1 |
| 47 | +echo. |
| 48 | +echo Changing permissions of Telemetry files... |
| 49 | +icacls %SystemRoot%\system32\CompatTelRunner.exe /deny *S-1-1-0:(X) |
| 50 | +if errorlevel 1 set errors=1 |
| 51 | +icacls %SystemRoot%\system32\GeneralTel.dll /deny *S-1-1-0:(X) |
| 52 | +if errorlevel 1 set errors=1 |
| 53 | +echo. |
| 54 | +echo Disabling Telemetry service... |
| 55 | +sc config DiagTrack start= disabled |
| 56 | +if errorlevel 1 set errors=1 |
| 57 | +echo. |
| 58 | +echo Terminating Telemetry processes... |
| 59 | +taskkill /f /im CompatTelRunner* |
| 60 | +taskkill /f /im rundll32* /fi "MODULES eq GeneralTel*" |
| 61 | +echo. |
| 62 | +echo Stopping Telemetry service... |
| 63 | +net stop DiagTrack 2>nul |
| 64 | +echo. |
| 65 | + |
| 66 | +rem Display results |
| 67 | +if "%errors%"=="1" goto :errors |
| 68 | + |
| 69 | +rem Success |
| 70 | +color f2 |
| 71 | +echo Telemetry should be disabled now. |
| 72 | +if not "%1"=="/AUTO" if not "%1"=="/auto" pause |
| 73 | + |
| 74 | +goto :end |
| 75 | + |
| 76 | +rem Errors occured |
| 77 | +:errors |
| 78 | +color fc |
| 79 | +echo Error(s) occurred, please review the script output! |
| 80 | +if not "%1"=="/AUTO" if not "%1"=="/auto" pause |
| 81 | + |
| 82 | +goto :end |
| 83 | + |
| 84 | +rem Missing admin rights error |
| 85 | +:noadmin |
| 86 | +color fc |
| 87 | +echo This script must be run with Administrator rights. |
| 88 | +echo Please right click on the script and select "Run as Administrator" |
| 89 | +if not "%1"=="/AUTO" if not "%1"=="/auto" pause |
| 90 | + |
| 91 | +rem For compatibility |
| 92 | +:end |
0 commit comments