caps_enhancer/server/install-client.ps1
2026-03-23 15:36:40 +03:00

38 lines
1.8 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Скрипт установки расширения через PowerShell (альтернатива .reg файлу)
# Запускать с правами администратора:
# Right Click -> "Запустить от имени администратора"
# или: Start-Process powershell -Verb RunAs -ArgumentList "-File install-client.ps1"
param(
[string]$ExtensionId = "EXTENSION_ID",
[string]$UpdateUrl = "https://YOUR_DOMAIN/caps-enhancer/update.xml"
)
$registryPath = "HKLM:\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist"
$value = "$ExtensionId;$UpdateUrl"
# Создаём ключ если не существует
if (-not (Test-Path $registryPath)) {
New-Item -Path $registryPath -Force | Out-Null
Write-Host "[OK] Создан ключ реестра: $registryPath"
}
# Ищем свободный номер (1, 2, 3, ...)
$index = 1
while (Get-ItemProperty -Path $registryPath -Name "$index" -ErrorAction SilentlyContinue) {
# Проверяем, вдруг расширение уже добавлено
$existing = (Get-ItemProperty -Path $registryPath -Name "$index")."$index"
if ($existing -like "$ExtensionId;*") {
Write-Host "[INFO] Расширение уже установлено (запись $index)."
Write-Host " Значение: $existing"
exit 0
}
$index++
}
Set-ItemProperty -Path $registryPath -Name "$index" -Value $value -Type String
Write-Host "[OK] Расширение добавлено в реестр (запись $index):"
Write-Host " $value"
Write-Host ""
Write-Host "Chrome автоматически установит расширение при следующем запуске."
Write-Host "Если Chrome уже открыт — перезапустите его."