├── README.md ├── LICENSE ├── Add_Chrome_Extensions_using_registry.ps1 ├── Add_Chrome_Extensions_using_policy.ps1 └── Add_Chrome_Extensions.ps1 /README.md: -------------------------------------------------------------------------------- 1 | ## Install Chrome Extensions 2 | 3 | ## Links 4 | 5 | * [Download Chrome](https://www.google.com/intl/ru/chrome/) 6 | * [Download offline installer](https://www.google.com/intl/ru/chrome/?standalone=1) 7 | * [Download .msi installer](https://chromeenterprise.google/browser/download) 8 | * [Download via PowerShell](https://github.com/farag2/Utilities/tree/master/Download) 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Dmitry Nefedov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Add_Chrome_Extensions_using_registry.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Install Chrome Extensions using the registry 4 | 5 | .PARAMETER ExtensionIDs 6 | String value of an extension ID taken from the Chrome Web Store URL for the extension 7 | 8 | .LINKS 9 | https://developer.chrome.com/docs/extensions/how-to/distribute/install-extensions 10 | #> 11 | function Add-ChromeExtension 12 | { 13 | [CmdletBinding()] 14 | param 15 | ( 16 | [Parameter(Mandatory = $true)] 17 | [string[]] 18 | $ExtensionIDs 19 | ) 20 | 21 | foreach ($ExtensionID in $ExtensionIDs) 22 | { 23 | if (-not (Test-Path -Path "HKLM:\SOFTWARE\WOW6432Node\Google\Chrome\Extensions\$ExtensionID")) 24 | { 25 | New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Google\Chrome\Extensions\$ExtensionID" -Force 26 | } 27 | New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Google\Chrome\Extensions\$ExtensionID" -Name update_url -PropertyType String -Value "https://clients2.google.com/service/update2/crx" -Force 28 | } 29 | } 30 | Add-ChromeExtension -ExtensionIDs @( 31 | # https://chromewebstore.google.com/detail/ublock-origin-lite/ddkjiahejlhfcafbddmgiahcphecmpfh 32 | "ddkjiahejlhfcafbddmgiahcphecmpfh", 33 | # https://chrome.google.com/webstore/detail/sponsorblock-for-youtube/mnjggcdmjocbbbhaepdhchncahnbgone 34 | "mnjggcdmjocbbbhaepdhchncahnbgone" 35 | # https://chrome.google.com/webstore/detail/return-youtube-dislike/gebbhagfogifgggkldgodflihgfeippi 36 | "gebbhagfogifgggkldgodflihgfeippi" 37 | ) 38 | -------------------------------------------------------------------------------- /Add_Chrome_Extensions_using_policy.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Install Chrome Extensions using the registry policy 4 | 5 | .PARAMETER ExtensionID 6 | String value of an extension ID taken from the Chrome Web Store URL for the extension 7 | 8 | .EXAMPLE Install uBlock Origin 9 | Add-ChromeExtension -ExtensionID @("cjpalhdlnbpafiamejdnhcphjbkeiagm") -Hive HKLM -Verbose 10 | 11 | .NOTES 12 | if you remove the HKLM:\Software\Policies\Google\Chrome\ExtensionInstallForcelist key all extensions will be uninstalled 13 | 14 | .LINK 15 | https://chromeenterprise.google/policies/#ExtensionInstallForcelist 16 | #> 17 | function Add-ChromeExtension 18 | { 19 | [cmdletBinding()] 20 | param 21 | ( 22 | [Parameter(Mandatory)] 23 | [String[]] 24 | $ExtensionIDs 25 | ) 26 | 27 | foreach ($ExtensionID in $ExtensionIDs) 28 | { 29 | if (-not (Test-Path -Path "HKLM:\Software\Policies\Google\Chrome\ExtensionInstallForcelist")) 30 | { 31 | [int]$Count = 0 32 | New-Item -Path "HKLM:\Software\Policies\Google\Chrome\ExtensionInstallForcelist" -Force 33 | } 34 | else 35 | { 36 | [int]$Count = (Get-Item -Path "HKLM:\Software\Policies\Google\Chrome\ExtensionInstallForcelist").Property.Count 37 | } 38 | 39 | $Name = $Count + 1 40 | New-ItemProperty -Path "HKLM:\Software\Policies\Google\Chrome\ExtensionInstallForcelist" -Name $Name -Value "$ExtensionID;https://clients2.google.com/service/update2/crx" -PropertyType String -Force 41 | } 42 | } 43 | Add-ChromeExtension -ExtensionIDs @( 44 | # https://chromewebstore.google.com/detail/ublock-origin-lite/ddkjiahejlhfcafbddmgiahcphecmpfh 45 | "ddkjiahejlhfcafbddmgiahcphecmpfh", 46 | # https://chrome.google.com/webstore/detail/sponsorblock-for-youtube/mnjggcdmjocbbbhaepdhchncahnbgone 47 | "mnjggcdmjocbbbhaepdhchncahnbgone" 48 | # https://chrome.google.com/webstore/detail/return-youtube-dislike/gebbhagfogifgggkldgodflihgfeippi 49 | "gebbhagfogifgggkldgodflihgfeippi" 50 | ) 51 | -------------------------------------------------------------------------------- /Add_Chrome_Extensions.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Add extensions to Chrome automatically 4 | 5 | .PARAMETER ExtentionIDs 6 | Copy an ID from extention's URL on Chrome Web Store 7 | 8 | .EXAMPLE 9 | $Parameters = @{ 10 | ExtentionIDs = @( 11 | "cjpalhdlnbpafiamejdnhcphjbkeiagm", 12 | "dhdgffkkebhmkfjojejmpbldmpobfkfo", 13 | "mnjggcdmjocbbbhaepdhchncahnbgone" 14 | ) 15 | } 16 | Add-ChromeExtension @Parameters 17 | 18 | .NOTES 19 | Enable Chrome Extensions Developer Mode first 20 | 21 | .NOTES 22 | Enable extension manually by opening the chrome://extensions page to load unpacked extensions one by one 23 | by selecting their folders (where the manifest is) in "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Extensions" 24 | #> 25 | function Add-ChromeExtension 26 | { 27 | [CmdletBinding()] 28 | param 29 | ( 30 | [Parameter(Mandatory = $true)] 31 | [string[]] 32 | $ExtentionIDs 33 | ) 34 | 35 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 36 | 37 | $DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" 38 | 39 | foreach ($ExtentionID in $ExtentionIDs) 40 | { 41 | # Create a folder to expand all files to 42 | if (-not (Test-Path -Path "$DownloadsFolder\Extensions\$ExtentionID")) 43 | { 44 | New-Item -Path "$DownloadsFolder\Extensions\$ExtentionID" -ItemType Directory -Force 45 | } 46 | 47 | # Downloading extension 48 | $Parameters = @{ 49 | Uri = "https://clients2.google.com/service/update2/crx?response=redirect&prodversion=110.0&acceptformat=crx3&x=id%3D$($ExtentionID)%26uc" 50 | OutFile = "$DownloadsFolder\Extensions\$ExtentionID.crx" 51 | UseBasicParsing = $true 52 | Verbose = $true 53 | } 54 | Invoke-WebRequest @Parameters 55 | 56 | # Copy file and rename it into .zip 57 | Get-Item -Path "$DownloadsFolder\Extensions\$ExtentionID.crx" -Force | Foreach-Object -Process { 58 | $NewName = $_.FullName -replace ".crx", ".zip" 59 | Copy-Item -Path $_.FullName -Destination $NewName -Force 60 | } 61 | 62 | # Expand extension 63 | & tar.exe -x -f "$DownloadsFolder\Extensions\$ExtentionID.crx" -C "$DownloadsFolder\Extensions\$ExtentionID" -v 64 | 65 | # "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Extensions" is where all extensions are located 66 | if (-not (Test-Path -Path "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Extensions")) 67 | { 68 | New-Item -Path "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Extensions" -ItemType Directory -Force 69 | } 70 | Copy-Item -Path "$DownloadsFolder\Extensions\$ExtentionID" -Destination "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Extensions" -Recurse -Force 71 | } 72 | 73 | if (Test-Path -Path "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Extensions\dhdgffkkebhmkfjojejmpbldmpobfkfo") 74 | { 75 | # Open https://greasyfork.org/ru/scripts/19993-ru-adlist-js-fixes 76 | Start-Process -FilePath "$env:ProgramFiles\Google\Chrome\Application\chrome.exe" -ArgumentList "https://greasyfork.org/ru/scripts/19993-ru-adlist-js-fixes" 77 | } 78 | 79 | Remove-Item -Path "$DownloadsFolder\Extensions" -Recurse -Force 80 | 81 | Invoke-Item -Path "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Extensions" 82 | } 83 | 84 | $Parameters = @{ 85 | ExtentionIDs = @( 86 | # https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm 87 | "cjpalhdlnbpafiamejdnhcphjbkeiagm", 88 | # https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo 89 | "dhdgffkkebhmkfjojejmpbldmpobfkfo", 90 | # https://chrome.google.com/webstore/detail/sponsorblock-for-youtube/mnjggcdmjocbbbhaepdhchncahnbgone 91 | "mnjggcdmjocbbbhaepdhchncahnbgone" 92 | ) 93 | } 94 | Add-ChromeExtension @Parameters 95 | --------------------------------------------------------------------------------