Skip to content

Commit

Permalink
Add logic to remove Registry Keys via Tweaks (#2837)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marterich authored Oct 1, 2024
1 parent 0deac4e commit d855b08
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion functions/private/Set-WinUtilRegistry.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ function Set-WinUtilRegistry {
}

Write-Host "Set $Path\$Name to $Value"
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value -Force -ErrorAction Stop | Out-Null
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] {
Expand Down

0 comments on commit d855b08

Please sign in to comment.