/build/static/layout/Breadcrumb_cap_w.png

Identify all browser add-ons

Is there a way to pull in browser add-on information on machine assets?


2 Comments   [ + ] Show comments
  • What browser? - KevinG 2 weeks ago
  • Edge, Chrome, and Firefox - cappy1962 2 weeks ago

Answers (1)

Answer Summary:
Posted by: AmberSDNB 2 weeks ago
Senior Purple Belt
1

Top Answer

You would need to do something custom that runs in user context for each browser. This is what we do for Chrome...

Scheduled Script (runs daily at 9 AM)
Windows Run As: Logged in user
Schedule Options: Run on next connect if offline
Script runs ChromeExtensions.ps1 (see bottom of this post)

This script pulls a list of extensions from the user's appdata folder, queries what they are in manifest.json file or the webstore, then dumps it to a file called C:\Temp\ChromeExt.log

Part two is creating a Custom Inventory Rule to pull in the info from ChromeExt.log.
ShellCommandTextReturn(cmd /c type "C:\temp\ChromeExt.log")

It will then show under Custom Inventory Fields
B9NZIjOCfsA6AAAAAElFTkSuQmCC


ChromeExtensions.ps1 (I'm not the original author of this script, not sure where it came from. Pretty sure it was posted to ITNinja at some point. I did need to tweak it once since we've enabled it after Google changed something and it broke. This is the modified version. Adjust as needed for your environment.)

function Get-ChromeExtension {

<#

 .SYNOPSIS

    Gets Chrome Extensions from a local or remote computer

 .DESCRIPTION

    Gets the name, version and description of the installed extensions

    Admin rights are required to access other profiles on the local computer or

    any profiles on a remote computer.

    Internet access is required to lookup the extension ID on the Chrome web store

 .PARAMETER Computername

    The name of the computer to connect to

    The default is the local machine

 .PARAMETER Username

    The username to query i.e. the userprofile (c:\users\<username>)

    If this parameter is omitted, all userprofiles are searched

 .EXAMPLE

    PS C:\> Get-ChromeExtension


    This command will get the Chrome extensions from all the user profiles on the local computer

 .EXAMPLE

    PS C:\> Get-ChromeExtension -username Jsmith


    This command will get the Chrome extensions installed under c:\users\jsmith on the local computer


 .EXAMPLE

    PS C:\> Get-ChromeExtension -Computername PC1234,PC4567


    This command will get the Chrome extensions from all the user profiles on the two remote computers specified

 .NOTES

    Version 1.0

#>

    [cmdletbinding()]

    PARAM(

        [parameter(Position = 0)]

        [string]$Computername = $ENV:COMPUTERNAME

        ,

        [parameter(Position = 1)]

        [string]$Username

    )

    BEGIN {


        function Get-ExtensionInfo {

            <#

         .SYNOPSIS

            Get Name and Version of the a Chrome extension

         .PARAMETER Folder

            A directory object (under %userprofile%\AppData\Local\Google\Chrome\User Data\Default\Extensions)

        #>

            [cmdletbinding()]

            PARAM(

                [parameter(Position = 0)]

                [IO.DirectoryInfo]$Folder

            )

            BEGIN{


                $BuiltInExtensions = @{

                    'nmmhkkegccagdldgiimedpiccmgmieda' = 'Google Wallet'

                    'mhjfbmdgcfjbbpaeojofohoefgiehjai' = 'Chrome PDF Viewer'

                    'pkedcjkdefgpdelpbcmbmeomcjbeemfm' = 'Chrome Cast'

                }


            }

            PROCESS {

                # Extension folders are under %userprofile%\AppData\Local\Google\Chrome\User Data\Default\Extensions

                # Folder names match extension ID e.g. blpcfgokakmgnkcojhhkbfbldkacnbeo

                $ExtID = $Folder.Name


                if($Folder.FullName -match '\\Users\\(?<username>[^\\]+)\\'){

                    $Username = $Matches['username']

                }else{

                    $Username = ''

                }


                # There can be more than one version installed. Get the latest one

                $LastestExtVersionInstallFolder = Get-ChildItem -Path $Folder.Fullname | Where-Object { $_.Name -match '^[0-9\._-]+$' } | Sort-Object -Property CreationTime -Descending | Select-Object -First 1 -ExpandProperty Name


                # Get the version from the JSON manifest

                if (Test-Path -Path "$($Folder.Fullname)\$LastestExtVersionInstallFolder\Manifest.json") {


                    $Manifest = Get-Content -Path "$($Folder.Fullname)\$LastestExtVersionInstallFolder\Manifest.json" -Raw | ConvertFrom-Json

                    if ($Manifest) {

                        if (-not([string]::IsNullOrEmpty($Manifest.version))) {

                            $Version = $Manifest.version

                        }

                    }

                } else {

                    # Just use the folder name as the version

                    $Version = $LastestExtVersionInstallFolder.Name

                }


                if($BuiltInExtensions.ContainsKey($ExtID)){

                    # Built-in extensions do not appear in the Chrome Store


                    $Title = $BuiltInExtensions[$ExtID]

                    $Description = ''


                }else{

                    # Lookup the extension in the Store

                    $url = "https://chrome.google.com/webstore/detail/" + $ExtID + "?hl=en-us"


                    try {

                        # You may need to include proxy information

                        # $WebRequest = Invoke-WebRequest -Uri $url -ErrorAction Stop -Proxy 'http://proxy:port' -ProxyUseDefaultCredentials


                        $WebRequest = Invoke-WebRequest -Uri $url -ErrorAction Stop


                        if ($WebRequest.StatusCode -eq 200) {


                            # Get the HTML Page Title but remove ' - Chrome Web Store'

                            if (-not([string]::IsNullOrEmpty($WebRequest.ParsedHtml.title))) {


                                $ExtTitle = $WebRequest.ParsedHtml.title

                                if ($ExtTitle -match '\s-\s.*$') {

                                    $Title = $ExtTitle -replace '\s-\s.*$',''

                                    $extType = 'ChromeStore'


                                } else {

                                    $Title = $ExtTitle

                                }

                            }


                            # Screen scrape the Description meta-data

                            $Description = $webRequest.AllElements.InnerHTML | Where-Object { $_ -match '<meta name="Description" content="([^"]+)">' } | Select-object -First 1 | ForEach-Object { $Matches[1] }

                        }

                    } catch {

                        Write-Warning "Error during webstore lookup for '$ExtID' - '$_'"


                    }

                }


                [PSCustomObject][Ordered]@{

                    Name        = $Title

                    Version     = $Version

                    Description = $Description

                    Username    = $Username

                    ID          = $ExtID

                }


            }

        }


        $appData = $ENV:LOCALAPPDATA

        $extFolder = Get-childitem -Path "$appData\Google\Chrome" -Filter 'Extensions' -Directory -Recurse | %{$_.FullName}

        $Split = $extFolder -split "appData"

        $ExtensionFolderPath = "AppData" + $split[1]


    }


    PROCESS {

        Foreach ($Computer in $Computername) {


            if ($Username) {

                # Single userprofile

                $Path = Join-path -path "fileSystem::\\$Computer\C$\Users\$Username" -ChildPath $ExtensionFolderPath

                $Extensions = Get-ChildItem -Path $Path -Directory -ErrorAction SilentlyContinue


            } else {

                # All user profiles that contain this a Chrome extensions folder

                $Path = Join-path -path "fileSystem::\\$Computer\C$\Users\*" -ChildPath $ExtensionFolderPath

                $Extensions =@()

                Get-Item -Path $Path -ErrorAction SilentlyContinue | ForEach-Object{


                    $Extensions += Get-ChildItem -Path $_ -Directory -ErrorAction SilentlyContinue

                }


            }


            if (-not($null -eq $Extensions)) {


                Foreach ($Extension in $Extensions) {


                    $Output = Get-ExtensionInfo -Folder $Extension

                    $Output | Add-Member -MemberType NoteProperty -Name 'Computername' -Value $Computer

                    $Output


                }


            } else {

                Write-Warning "$Computer : no extensions were found"


            }


        }#foreach

    }

}



# Run function

Get-ChromeExtension > "C:\Temp\ChromeExt.log"


Comments:
  • Thanks so much! exactly what I was looking for. - cappy1962 2 days ago
    • No problem. After writing this, it appears it no longer works properly. Google changed the web store URLs, so it's much more difficult (or impossible) to do a web lookup now.

      New script below queries some of the JSON files for the extension info. It doesn't work on all extensions (not all of them write to those files apparently) but it should work for a large number of them.

      Blog post:
      https://www.itninja.com/blog/view/get-installed-google-chrome-extensions - AmberSDNB 2 days ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ