A collection of Scripts which disable / remove Windows 10 Features and Apps
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.7 KiB

# Description:
# This script blocks telemetry related domains via the hosts file and related
# IPs via Windows Firewall.
#
# Please note that adding these domains may break certain software like iTunes
# or Skype. As this issue is location dependent for some domains, they are not
# commented by default. The domains known to cause issues marked accordingly.
# Please see the related issue:
# <https://github.com/W4RH4WK/Debloat-Windows-10/issues/79>
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\New-FolderForced.psm1
Write-Output "Disabling telemetry via Group Policies"
New-FolderForced -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" "AllowTelemetry" 0
# Entries related to Akamai have been reported to cause issues with Widevine
# DRM.
Write-Output "Adding telemetry domains to hosts file"
$hosts_file = "$env:systemroot\System32\drivers\etc\hosts"
$domains = @(Get-Content $PSScriptRoot\..\blocklists\telemetry-domains.txt)
Write-Output "" | Out-File -Encoding ASCII -Append $hosts_file
foreach ($domain in $domains)
{
if (-Not (Select-String -Path $hosts_file -Pattern $domain)) {
if ($domain -notlike "#*" -and $domain -ne "" -and $domain -ne $null) {
Write-Output "0.0.0.0 $domain" | Out-File -Encoding ASCII -Append $hosts_file
}
}
}
Write-Output "Adding telemetry ips to firewall"
$ips = @(Get-Content $PSScriptRoot\..\blocklists\telemetry-ips.txt)
Remove-NetFirewallRule -DisplayName "Block Telemetry IPs" -ErrorAction SilentlyContinue
New-NetFirewallRule -DisplayName "Block Telemetry IPs" -Direction Outbound `
-Action Block -RemoteAddress ([string[]]$ips)