FunctionNew-ChromeExtension{<#.SYNOPSIS Add Chrome Extensions to PC via Powershell.PARAMETER ExtensionID String value of an extension ID taken from the Chrome Web Store URL for the extension.EXAMPLE This will install uBlock Origin New-ChromeExtension -ExtensionID 'cjpalhdlnbpafiamejdnhcphjbkeiagm'.EXAMPLE This will install uBlock Origin, and Zoom Meetings New-ChromeExtension -ExtensionID @('kgjfgplpablkjnlkjmjdecgdpfankdle', 'cjpalhdlnbpafiamejdnhcphjbkeiagm') -Verbose #>[cmdletBinding()]Param([Parameter(Mandatory)][String[]]$ExtensionID)Foreach($Extensionin$ExtensionID){$regLocation='Software\Policies\Google\Chrome\ExtensionInstallForcelist'# Each extension if you want to force install more than 1 extension needs its own key #If(!(Test-Path"HKLM:\$regLocation")){Write-Verbose-Message"No Registry Path, setting count to: 0"[int]$Count=0Write-Verbose-Message"Count is now $Count"New-Item-Path"HKLM:\$regLocation"-Force}Else{Write-Verbose-Message"Keys found, counting them..."[int]$Count=(Get-Item"HKLM:\$regLocation").CountWrite-Verbose-Message"Count is now $Count"}$regKey=$Count+1Write-Verbose-Message"Creating reg key with value $regKey"$regData="$Extension;https://clients2.google.com/service/update2/crx"New-ItemProperty-Path"HKLM:\$regLocation"-Name$regKey-Value$regData-PropertyTypeSTRING-Force}}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.