Skip to content

Instantly share code, notes, and snippets.

@msoxzw
Created August 6, 2021 09:18
Show Gist options
  • Save msoxzw/b2215d8407eae8ec1880ef6bb0f43076 to your computer and use it in GitHub Desktop.
Save msoxzw/b2215d8407eae8ec1880ef6bb0f43076 to your computer and use it in GitHub Desktop.
Add Internet Explorer Tracking Protection Lists from known Adblock Plus subscriptions and by language
Push-Location $PSScriptRoot
$subscriptionsURL = 'https://raw.githubusercontent.com/adblockplus/adblockpluscore/master/data/subscriptions.json'
$subscriptions = Invoke-WebRequest $subscriptionsURL | ConvertFrom-Json
$language = (Get-UICulture).TwoLetterISOLanguageName
if ($language -notin $subscriptions.languages) {$language = 'en'}
$registryPath = 'HKCU:\Software\Microsoft\Internet Explorer\Safety\PrivacIE\Lists'
$added = Get-ItemPropertyValue "$registryPath\*" 'Name'
$subscriptions | Where-Object {$_.title -notin $added -and ($null -eq $_.languages -or $language -in $_.languages)} | ForEach-Object {[PSCustomObject]@{'Enabled' = 1; 'Name' = $_.title; 'Url' = $_.url -replace '\.txt$','.tpl'} | Set-ItemProperty (New-Item $registryPath -Name "{$(New-Guid)}".ToUpper() -Force).PSPath}
Pop-Location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment