Added extension installation scripts
This commit is contained in:
parent
ac7b462475
commit
1e9c6ebc54
44
installExtension.ps1
Normal file
44
installExtension.ps1
Normal file
@ -0,0 +1,44 @@
|
||||
#Zebra - 2/22/2024
|
||||
#Installs extension of your choice to firefox, chrome, or edge.
|
||||
#Must include the following arguments: -browserType -extensionID
|
||||
|
||||
param (
|
||||
[string]$browserType = "Edge",
|
||||
[string]$extensionID
|
||||
)
|
||||
|
||||
#Selecting the registry path to install the extension to. Defaults to msedge
|
||||
|
||||
switch -Regex ($browserType.ToLower()) {
|
||||
"chrome" {
|
||||
$registryPath = "HKLM:\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist"
|
||||
}
|
||||
"edge" {
|
||||
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Edge\ExtensionInstallForcelist"
|
||||
}
|
||||
"firefox" {
|
||||
$registryPath = "HKLM:\SOFTWARE\Mozilla\Firefox\Extensions"
|
||||
}
|
||||
Default {
|
||||
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Edge\ExtensionInstallForcelist"
|
||||
}
|
||||
}
|
||||
|
||||
# Checking if the registry path exists, if not, create it
|
||||
if (!(Test-Path $registryPath)) {
|
||||
New-Item -Path $registryPath -Force
|
||||
}
|
||||
|
||||
# Checking the registry to find the highest number key
|
||||
$existingKeys = Get-ItemProperty -Path $registryPath | ForEach-Object { [int]($_.PSChildName) } | Sort-Object
|
||||
|
||||
if ($existingKeys) {
|
||||
$nextValue = $existingKeys[-1] + 1
|
||||
} else {
|
||||
$nextValue = 1
|
||||
}
|
||||
|
||||
# Adding the key to the registry
|
||||
New-ItemProperty -Path $registryPath -Name $nextValue -Value $ExtensionID -PropertyType "String" -Force
|
||||
|
||||
Write-Host "Key added successfully under DWORD $nextValue."
|
17
installUblock.ps1
Normal file
17
installUblock.ps1
Normal file
@ -0,0 +1,17 @@
|
||||
#Zebra - 2/22/2024
|
||||
#Force installs uBlock Origin to Edge and Chrome.
|
||||
#Delete regkeys to remove
|
||||
|
||||
# Defining the web store extension IDs
|
||||
$chromeKey = "cjpalhdlnbpafiamejdnhcphjbkeiagm"
|
||||
$edgeKey = "odfafepnkmbhccpbejgmiehpchacaeak"
|
||||
|
||||
# Defining the paths for each regkey
|
||||
$chromePath = "HKLM:\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist"
|
||||
$edgePath = "HKLM:\SOFTWARE\Policies\Microsoft\Edge\ExtensionInstallForcelist"
|
||||
|
||||
# Add the keys to the registry
|
||||
New-ItemProperty -Path $chromePath -Name "1" -Value $chromeKey -PropertyType "String" -Force
|
||||
New-ItemProperty -Path $edgePath -Name "1" -Value $edgeKey -PropertyType "String" -Force
|
||||
|
||||
Write-Host "uBlock installed on Chrome and Edge successfully."
|
Loading…
Reference in New Issue
Block a user