# ChromeとEdgeの拡張機能削除ポリシーをサイレントに設定するスクリプト
# --- Chrome の設定 ---
$chromeBaseRegistryPath = "HKLM:\Software\Policies\Google\Chrome"
$chromeValueName = "ExtensionSettings"
$chromeJsonData = '{"moaklgcgokbgplldonjkoochhlefkbjf":{"installation_mode":"removed"}}'
# Chromeのレジストリパスが存在しない場合、サイレントに作成
if (-not (Test-Path $chromeBaseRegistryPath)) {
New-Item -Path $chromeBaseRegistryPath -Force | Out-Null
}
# ChromeのExtensionSettingsキー(もし誤ってフォルダとして存在すれば)をサイレントに削除
if (Test-Path "$chromeBaseRegistryPath\$chromeValueName" -PathType Container) {
Remove-Item -Path "$chromeBaseRegistryPath\$chromeValueName" -Recurse -Force | Out-Null
}
# ChromeのExtensionSettingsレジストリ値を追加または更新
Set-ItemProperty -Path $chromeBaseRegistryPath -Name $chromeValueName -Value $chromeJsonData -Force | Out-Null
# --- Edge の設定 ---
$edgeBaseRegistryPath = "HKLM:\Software\Policies\Microsoft\Edge"
$edgeValueName = "ExtensionSettings"
$edgeJsonData = '{"hjifncajikcdkhlofdjjlhcjoennmdfc":{"installation_mode":"removed"}}'
# Edgeのレジストリパスが存在しない場合、サイレントに作成
if (-not (Test-Path $edgeBaseRegistryPath)) {
New-Item -Path $edgeBaseRegistryPath -Force | Out-Null
}
# EdgeのExtensionSettingsキー(もし誤ってフォルダとして存在すれば)をサイレントに削除
if (Test-Path "$edgeBaseRegistryPath\$edgeValueName" -PathType Container) {
Remove-Item -Path "$edgeBaseRegistryPath\$edgeValueName" -Recurse -Force | Out-Null
}
# EdgeのExtensionSettingsレジストリ値を追加または更新
Set-ItemProperty -Path $edgeBaseRegistryPath -Name $edgeValueName -Value $edgeJsonData -Force | Out-Null