PowerShell Tutorials

How To Install Chrome Extensions With PowerShell

In this article, we will guide you through the process of installing Chrome extensions using a PowerShell script, tailored specifically for Group Policy deployment.


Introduction

Google Chrome, with its vast array of extensions, remains a predominant choice among internet users. For system administrators or IT professionals, there might arise situations where a specific Chrome extension needs to be deployed across multiple machines. Manual installation in such scenarios is not only tedious but also time-consuming. Enter PowerShell, Microsoft’s task automation framework. With PowerShell, you can seamlessly deploy a Chrome extension across various systems.

Prerequisites:

  • Google Chrome: Ensure it’s installed on the system(s) you’re targeting.
  • PowerShell: Generally comes pre-installed with Windows.
  • Administrative Privileges: Needed since modifying the registry demands elevated permissions.

Note: You can use this script to deploy extensions through a Remote Utility that runs as System/Administrator.

PowerShell-7

The Chrome Extension Installation PowerShell Script:

Here’s the complete script you’ll use:

# PowerShell Script for Chrome Extension Deployment via Group Policy

# Define the extension ID and update URL
$extensionID = "Enter APP ID HERE"
$updateURL = "https://clients2.google.com/service/update2/crx"

# Define the registry path for Chrome Extensions
$regPath = "HKLM:\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist"

# Check if registry path exists
if(-not (Test-Path $regPath)) {
    # Create the registry path
    New-Item -Path $regPath -Force
}

# Define the registry entry for the extension
$regValue = "$extensionID;$updateURL"

# Add the registry entry
Set-ItemProperty -Path $regPath -Name "1" -Value $regValue -Force

# Note: Ensure that PowerShell is run with administrative privileges to modify the registry

Explanation:

  1. Defining the Extension: Every Chrome extension comes with a unique ID. You need this ID and the official Google update URL. In the script, the $extensionID holds the ID, and $updateURL contains the update link.

Execution:

Upon successful execution, the specified Chrome extension will be set to forcibly install on the system the next time Chrome starts.

The Chrom Extension Removal PowerShell Script

Removing an extension via PowerShell directly might not be straightforward due to Chrome’s security model. However, you can disable force-installing an extension by removing or modifying the respective registry entry that you’ve previously added.

Here’s an example PowerShell script that removes a specified Chrome extension from the forced install list by altering the Windows registry:

# PowerShell Script to Remove Forced Installed Chrome Extension

# Define the registry path for Chrome Extensions
$regPath = "HKLM:\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist"

# Check if registry path exists
if(Test-Path $regPath) {

    # Check if the specific extension registry key exists
    if(Get-ItemProperty -Path $regPath -Name "1" -ErrorAction SilentlyContinue) {

        # Remove the registry entry for the extension
        Remove-ItemProperty -Path $regPath -Name "1" -Force

        Write-Host "Extension registry entry removed successfully."
    }
    else {
        Write-Host "Extension registry entry not found."
    }
}
else {
    Write-Host "Chrome policy registry path does not exist."
}

# Note: Ensure that PowerShell is run with administrative privileges to modify the registry

In the script above, replace "1" with the exact name of the registry key that you used when you forced the installation of the extension. Ensure you run the script with administrative privileges as it modifies the Windows registry.

Please note that this script does not uninstall the extension; it merely removes the policy forcing its installation. Users may manually remove it, or it might be automatically removed upon the next launch of Chrome, depending on your environment and specific policy settings. Always ensure you adhere to relevant policies and guidelines when deploying and managing software.

Conclusion:

Automating Chrome extension installations via PowerShell, especially for multiple deployments, can save considerable time and effort. Always ensure you have the necessary permissions and backup your system or registry before making any changes.

I hope this article was helpful! You can find more here: Windows Articles

author avatar
Patrick Domingues

Leave a Comment

Stay Informed

Receive instant notifications when new content is released.