mirror of
https://github.com/aamitn/bpc.git
synced 2025-06-27 10:21:48 +05:30
39 lines
1.1 KiB
PowerShell
39 lines
1.1 KiB
PowerShell
param(
|
|
[Parameter(Mandatory=$true)]
|
|
[ValidateSet("edge", "chrome", "brave")]
|
|
[string]$browser
|
|
)
|
|
|
|
$regPath = switch ($browser) {
|
|
"edge" { "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge\ExtensionInstallAllowlist" }
|
|
"chrome" { "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\ExtensionInstallAllowlist" }
|
|
"brave" { "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\BraveSoftware\Brave\ExtensionInstallAllowlist" }
|
|
}
|
|
|
|
$valueData = "lkbebcjgcmobigpeffafkodonchffocl"
|
|
|
|
if (Test-Path $regPath) {
|
|
|
|
$values = Get-ItemProperty $regPath
|
|
|
|
} else {
|
|
|
|
New-Item -Path $regPath -ItemType RegistryKey -Force
|
|
|
|
}
|
|
|
|
if ($values | Where-Object { $_.PSObject.Properties.Value -eq $valueData} ) {
|
|
|
|
Write-Host "The value already exists."
|
|
|
|
} else {
|
|
$newValueName = 1
|
|
while ($values | Where-Object { $_.PSObject.Properties.Name -eq $newValueName.ToString()} ) {
|
|
$newValueName++
|
|
}
|
|
|
|
New-ItemProperty -Path $regPath -Name $newValueName -Value $valueData -PropertyType String
|
|
|
|
Write-Host "A new value has been added with the name '$newValueName'."
|
|
|
|
}
|