# Install-GenaiaExtension.ps1 # Downloads and installs the Genaia browser extension for Chrome and Edge. # No admin rights required - uses HKCU registry. $ExtensionId = "mphdnpdppdjefnebljampblngebpkbmm" $UpdatesUrl = "https://get.genaia.app/extension-updates.xml" # IDs of earlier builds signed with a key that no longer exists. Chrome treats them as a different # extension that never receives updates, so their force-install entries are removed. $LegacyExtensionIds = @("ohllpacleajmjdcdkjefbccfmpbjapdp") $Browsers = @( @{ Name = "Chrome"; Key = "HKCU:\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist" }, @{ Name = "Edge"; Key = "HKCU:\SOFTWARE\Policies\Microsoft\Edge\ExtensionInstallForcelist" } ) $Value = "$ExtensionId;$UpdatesUrl" foreach ($browser in $Browsers) { if (-not (Test-Path $browser.Key)) { New-Item -Path $browser.Key -Force | Out-Null } # Remove entries of legacy extension IDs (collect first, then remove). $existing = Get-ItemProperty -Path $browser.Key -ErrorAction SilentlyContinue if ($existing) { $legacyNames = @() foreach ($prop in $existing.PSObject.Properties) { foreach ($legacyId in $LegacyExtensionIds) { if ($prop.Value -is [string] -and $prop.Value -like "$legacyId*") { $legacyNames += $prop.Name } } } foreach ($name in $legacyNames) { Remove-ItemProperty -Path $browser.Key -Name $name -ErrorAction SilentlyContinue Write-Host "$($browser.Name): removed legacy entry at slot $name" } } # Find first free numeric slot (1, 2, 3, ...) $existing = Get-ItemProperty -Path $browser.Key -ErrorAction SilentlyContinue $alreadyInstalled = $false if ($existing) { foreach ($prop in $existing.PSObject.Properties) { if ($prop.Value -is [string] -and $prop.Value -like "$ExtensionId*") { $alreadyInstalled = $true break } } } if ($alreadyInstalled) { Write-Host "$($browser.Name): already configured, skipping" continue } $slot = 1 while ($null -ne (Get-ItemProperty -Path $browser.Key -Name "$slot" -ErrorAction SilentlyContinue)."$slot") { $slot++ } Set-ItemProperty -Path $browser.Key -Name "$slot" -Value $Value -Type String Write-Host "$($browser.Name): registered at slot $slot" } Write-Host "" Write-Host "Done. Restart Chrome or Edge - the Genaia extension will install automatically." Write-Host "Future updates are applied automatically without any action required."