Browser Extension Finder

$excludeUsers = @("Public", "LocalAdmin")

$chromePath = "\AppData\Local\Google\Chrome\User Data"
$edgePath = "\AppData\Local\Microsoft\Edge\User Data"
$firefoxPath = "\AppData\Roaming\Mozilla\Firefox\Profiles"

$results = @{}

try {
    Get-ChildItem C:\Users\* -Directory | Where-Object { $excludeUsers -notcontains $_.Name } | ForEach-Object {
        $user = $_.Name
        $results[$user] = @{}

        # Google Chrome Extensions
        try {
            $chromeProfilePath = "C:\Users\$user$chromePath"
            if (Test-Path $chromeProfilePath) {
                $results[$user]["Google Chrome"] = @{}
                Get-ChildItem -Path $chromeProfilePath -Directory | Where-Object { $_.Name -ne 'System Profile' } | ForEach-Object {
                    $profileName = $_.Name
                    try {
                        $extensionsPath = $_.FullName + "\Extensions"
                        if (Test-Path $extensionsPath) {
                            $results[$user]["Google Chrome"][$profileName] = @()
                            Get-ChildItem -Path $extensionsPath -Directory | ForEach-Object {
                                $extensionID = $_.Name
                                $results[$user]["Google Chrome"][$profileName] += $extensionID
                            }
                        }
                    } catch {}
                }
            }
        } catch {}

        # Microsoft Edge Extensions
        try {
            $edgeProfilePath = "C:\Users\$user$edgePath"
            if (Test-Path $edgeProfilePath) {
                $results[$user]["Microsoft Edge"] = @{}
                Get-ChildItem -Path $edgeProfilePath -Directory | Where-Object { $_.Name -ne 'System Profile' } | ForEach-Object {
                    $profileName = $_.Name
                    try {
                        $extensionsPath = $_.FullName + "\Extensions"
                        if (Test-Path $extensionsPath) {
                            $results[$user]["Microsoft Edge"][$profileName] = @()
                            Get-ChildItem -Path $extensionsPath -Directory | ForEach-Object {
                                $extensionID = $_.Name
                                $results[$user]["Microsoft Edge"][$profileName] += $extensionID
                            }
                        }
                    } catch {}
                }
            }
        } catch {}

        # Firefox Extensions
        try {
            $firefoxProfilePath = "C:\Users\$user$firefoxPath"
            if (Test-Path $firefoxProfilePath) {
                $results[$user]["Firefox"] = @{}
                Get-ChildItem -Path $firefoxProfilePath -Filter "*.default*" -Directory | ForEach-Object {
                    $profileName = $_.Name
                    try {
                        $extensionsPath = $_.FullName + "\extensions"
                        if (Test-Path $extensionsPath) {
                            $results[$user]["Firefox"][$profileName] = @()
                            Get-ChildItem -Path $extensionsPath | ForEach-Object {
                                $extensionID = $_.Name
                                $results[$user]["Firefox"][$profileName] += $extensionID
                            }
                        }
                    } catch {}
                }
            }
        } catch {}
    }
} catch {}

# Custom formatting of the results
foreach ($user in $results.Keys) {
    Write-Output "$user"
    foreach ($browser in $results[$user].Keys) {
        Write-Output "    - $browser"
        foreach ($profile in $results[$user][$browser].Keys) {
            Write-Output "         - $profile"
            foreach ($extension in $results[$user][$browser][$profile]) {
                Write-Output "              - $extension"
            }
        }
    }
    Write-Output "--------------------------"
}

Last updated

Was this helpful?