Add logic to remove Registry Keys via Tweaks (#2837)

This commit is contained in:
Martin Wiethan 2024-10-01 22:51:18 +02:00 committed by GitHub
parent 0deac4ebb2
commit d855b08119
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,7 +36,12 @@ function Set-WinUtilRegistry {
}
Write-Host "Set $Path\$Name to $Value"
if ($Value -ne "<RemoveEntry>"){
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value -Force -ErrorAction Stop | Out-Null
}
else{
Remove-ItemProperty -Path $Path -Name $Name -Force -ErrorAction Stop | Out-Null
}
} catch [System.Security.SecurityException] {
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
} catch [System.Management.Automation.ItemNotFoundException] {