-
Notifications
You must be signed in to change notification settings - Fork 0
/
disableTelemetry.bat
136 lines (101 loc) · 4.09 KB
/
disableTelemetry.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
@echo off
setlocal
:main
call :updateRegistry
call :disableTasks
REM call :disableServices
REM call :blockIps
REM call :updateHosts
exit /b %errorlevel%
:updateRegistry
setlocal
echo updateRegistry
REM 0: Security (Enterprise only), 1: Basic, 2: Enhanced, 3: Full
REM reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "MaxTelemetryAllowed" /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "Allow Telemetry" /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener" /v "Start" /t REG_DWORD /d 0 /f
REM == call :disableServices
reg add "HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack" /v "Start" /t REG_DWORD /d 4 /f
:: IntelTA.sys
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Telemetry " /v "Start" /t REG_DWORD /d 4 /f
reg add "HKCU\SOFTWARE\Microsoft\Siuf\Rules" /v "NumberOfSIUFInPeriod " /t REG_DWORD /d 0 /f
reg add "HKCU\SOFTWARE\Microsoft\Siuf\Rules" /v "PeriodInNanoSeconds " /t REG_DWORD /d 0 /f
:: AllowTelemetry : minimal data 1 on windows home/pro, 0 on enterprise
:: Services : Disabled (4) - Indicates that the service is disabled, so that it cannot be started by a user or application.
endlocal
exit /b %errorlevel%
:updateHosts
setlocal
echo updateHosts
set "file=%windir%\system32\drivers\etc\hosts"
echo 0.0.0.0 geo.settings-win.data.microsoft.com.akadns.net >> "%file%"
echo 0.0.0.0 db5-eap.settings-win.data.microsoft.com.akadns.net >> "%file%"
echo 0.0.0.0 settings-win.data.microsoft.com >> "%file%"
echo 0.0.0.0 db5.settings-win.data.microsoft.com.akadns.net >> "%file%"
echo 0.0.0.0 asimov-win.settings.data.microsoft.com.akadns.net >> "%file%"
echo 0.0.0.0 db5.vortex.data.microsoft.com.akadns.net >> "%file%"
echo 0.0.0.0 v10-win.vortex.data.microsft.com.akadns.net >> "%file%"
echo 0.0.0.0 geo.vortex.data.microsoft.com.akadns.net >> "%file%"
echo 0.0.0.0 v10.vortex-win.data.microsft.com >> "%file%"
echo 0.0.0.0 us.vortex-win.data.microsft.com >> "%file%"
echo 0.0.0.0 eu.vortex-win.data.microsft.com >> "%file%"
echo 0.0.0.0 vortex-win-sandbox.data.microsoft.com >> "%file%"
echo 0.0.0.0 alpha.telemetry.microsft.com >> "%file%"
echo 0.0.0.0 oca.telemetry.microsft.com >> "%file%"
endlocal
exit /b %errorlevel%
:disableTasks
setlocal
echo disableTasks
schtasks /Change /TN "\Microsoft\Windows\WindowsUpdate\RUXIM\PLUGScheduler" /Disable
endlocal
exit /b %errorlevel%
:disableServices
setlocal
echo disableServices
REM ServiceName: DiagTrack
REM DisplayName: Connected User Experiences and Telemetry
call :disableService DiagTrack
endlocal
exit /b %errorlevel%
:disableService
setlocal
set name=%~1
sc config "%name%" start= disabled
sc stop "%name%"
endlocal
exit /b %errorlevel%
:blockIps
setlocal
echo blockIps
set list=40.77.226.249 40.77.226.250 13.92.194.212 52.178.38.151 52.229.39.152 52.183.114.173 13.78.232.226
(for %%ip in (%list%) do (
call :blockIp %%ip
))
endlocal
exit /b %errorlevel%
:blockIp
setlocal
set ip=%~1
set prog_name=DiagTrack
set /a block=1
echo block %ip%
call :makeRule
endlocal
exit /b %errorlevel%
:makeRule
setlocal
set "rule_name=%~1"
set "program_name=%~2"
set /a block=%3
echo Deleting "%rule_name%" rule
netsh advfirewall firewall delete rule name="%rule_name%"
if %block% == 1 (
echo Blocking "%rule_name%" : "%program_name%"
netsh advfirewall firewall add rule name="%rule_name%" dir=in action=block profile=any program="%program_name%"
netsh advfirewall firewall add rule name="%rule_name%" dir=out action=block profile=any program="%program_name%"
)
endlocal
exit /b %errorlevel%