diff --git a/Winget-AutoUpdate/mods/_AppID-template.ps1 b/Winget-AutoUpdate/mods/_AppID-template.ps1 index ef6392c..e7d942f 100644 --- a/Winget-AutoUpdate/mods/_AppID-template.ps1 +++ b/Winget-AutoUpdate/mods/_AppID-template.ps1 @@ -22,7 +22,8 @@ $AddValue = "" $AddTypeData = "" $AddType = "" -#Registry _value_ to delete in existing registry Key. Example: +#Registry _value_ to delete in existing registry Key. +#Value can be omitted for deleting entire Key!. Example: #$DelKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" #$DelValue = "WAU_BypassListForUsers" $DelKey = "" @@ -50,7 +51,7 @@ if ($Lnk) { if ($AddKey -and $AddValue -and $AddTypeData -and $AddType) { Add-ModsReg $AddKey $AddValue $AddTypeData $AddType } -if ($DelKey -and $DelValue) { +if ($DelKey) { Remove-ModsReg $DelKey $DelValue } if ($DelFile) { diff --git a/Winget-AutoUpdate/mods/_Mods-Functions.ps1 b/Winget-AutoUpdate/mods/_Mods-Functions.ps1 index a4202a2..569253e 100644 --- a/Winget-AutoUpdate/mods/_Mods-Functions.ps1 +++ b/Winget-AutoUpdate/mods/_Mods-Functions.ps1 @@ -146,7 +146,12 @@ function Add-ModsReg ($AddKey, $AddValue, $AddTypeData, $AddType) { function Remove-ModsReg ($DelKey, $DelValue) { if (Test-Path "$DelKey") { - Remove-ItemProperty $DelKey -Name $DelValue -Force -ErrorAction SilentlyContinue | Out-Null + if (!$DelValue) { + Remove-Item $DelKey -Recurse -Force -ErrorAction SilentlyContinue | Out-Null + } + else { + Remove-ItemProperty $DelKey -Name $DelValue -Force -ErrorAction SilentlyContinue | Out-Null + } } Return }