-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtelemetry_killer.py
More file actions
26 lines (21 loc) · 939 Bytes
/
telemetry_killer.py
File metadata and controls
26 lines (21 loc) · 939 Bytes
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
import subprocess
import winreg
def run(cmd):
subprocess.run(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
def disable_telemetry():
services = ["DiagTrack", "DPS"]
for s in services:
run(f"sc stop {s}")
run(f"sc config {s} start= disabled")
tasks = [
r"\Microsoft\Windows\Customer Experience Improvement Program\Consolidator",
r"\Microsoft\Windows\Customer Experience Improvement Program\KernelCeipTask",
r"\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip",
r"\Microsoft\Windows\Application Experience\ProgramDataUpdater"
]
for t in tasks:
run(f'schtasks /Change /TN "{t}" /Disable')
key_path = r"SOFTWARE\Policies\Microsoft\Windows\DataCollection"
key = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, key_path)
winreg.SetValueEx(key, "AllowTelemetry", 0, winreg.REG_DWORD, 0)
winreg.CloseKey(key)