Category filter
Script to manage Google Chrome extensions on Windows devices
Chrome extensions extend the capabilities of the Google Chrome web browser by improving its functionality and customization. The vast repository of extensions eases our daily chores, from optimizing schedules to blocking unwanted ads. Using Hexnode, you can remotely deploy various custom scripts that let you manage the use of various Chrome extensions on your Windows devices.
Install Chrome extensions
The script creates a registry key entry in the HKLM key path HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist
. The ExtensionInstallForcelist policy can be used to specify a list of extensions that install without user interaction and which users can’t uninstall or turn off. For example, the below scripts install the Google Hangouts extension.
To locate the extension ID, open the Chrome Web Store and search the name of the Google Chrome extension you intend to install. You can find the ID as a long string of characters at the end of the URL.
Ex: Google Hangouts ID: nckgahadagoaajjgafhacjanaoiihapd
PowerShell Script (.ps1)
1 |
New-ItemProperty –Path "HKLM\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist " -Name "GoogleHangouts" -Value nckgahadagoaajjgafhacjanaoiihapd |
Replace the ID in the script with the ID of the extension you want to install and ‘GoogleHangouts’ with the name of your extension.
Batch Script (.bat)
1 |
reg add HKLM\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist /v 1 /t REG_SZ /d nckgahadagoaajjgafhacjanaoiihapd /f |
In the script, provide a name for the key in place of ‘1’ and replace nckgahadagoaajjgafhacjanaoiihapd with the extension ID you intend to install.
Remove Chrome extensions
The script below removes the registry entry with the key name ‘1’. Since there is already a key with the name ‘1’ that force installs the Google Hangouts extension, this script removes that key and thus the Google Hangouts extension.
Once the script is run successfully, the installed extensions will be removed from the device. Although please note that the users are free to install the removed extension later.
PowerShell Script (.ps1)
1 |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist" -Name 1 |
Block Chrome extensions
The script below creates a registry key entry in the HKLM key path HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\ExtensionInstallBlocklist
. The ExtensionInstallBlocklist policy allows you to specify which extensions cannot be installed by the user. Extensions already installed will be disabled if added to the block list, and the users cannot enable them.
Once the script below is run successfully, users cannot install the specified extensions. If the extensions are already installed, they will be blocked, and the users will be restricted from enabling them. For instance, the below script blocks the Google Hangouts extension.
PowerShell Script (.ps1)
1 |
New-ItemProperty –Path "HKLM\SOFTWARE\Policies\Google\Chrome\ExtensionInstallBlocklist " -Name "GoogleHangouts" -Value nckgahadagoaajjgafhacjanaoiihapd |
Replace the name (‘GoogleHangouts’) and value (‘nckgahadagoaajjgafhacjanaoiihapd’) in the script with the name and ID of the extension you intend to remove. Set the value as * to block all the extensions.
Batch Script (.bat)
1 |
reg add HKLM\SOFTWARE\Policies\Google\Chrome\ExtensionInstallBlocklist /v 1 /t REG_SZ /d nckgahadagoaajjgafhacjanaoiihapd /f |
In the script, provide a name for the key instead of ‘1’ and replace nckgahadagoaajjgafhacjanaoiihapd with the ID of the extension you want to block.
Allow Chrome Extensions
All extensions are allowed by default. However, if the value is set as * in the ExtensionInstallBlocklist policy of the Windows registry, all the extensions will be blocked. The script below creates a registry key entry in the HKLM key path HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\ExtensionInstallAllowlist
to allow users to access only the specified extensions. For instance, the below script allows access to the Google Hangouts extension by creating a new key in the windows registry.
PowerShell Script (.ps1)
1 |
New-ItemProperty –Path "HKLM\SOFTWARE\Policies\Google\Chrome\ExtensionInstallAllowlist " -Name "GoogleHangouts" -Value nckgahadagoaajjgafhacjanaoiihapd |
Replace the ID in the script with the ID of the extension you want to allow and ‘GoogleHangouts’ with the name of your extension.
Batch Script (.bat)
1 |
reg add HKLM\SOFTWARE\Policies\Google\Chrome\ExtensionInstallAllowlist /v 1 /t REG_SZ /d nckgahadagoaajjgafhacjanaoiihapd /f |
Provide a key name in place of ‘1’ and the extension ID you want to allow in place of nckgahadagoaajjgafhacjanaoiihapd.