Delete entire Key in Mod Template/Functions too
parent
6301fd9622
commit
53113310c0
|
@ -22,7 +22,8 @@ $AddValue = ""
|
||||||
$AddTypeData = ""
|
$AddTypeData = ""
|
||||||
$AddType = ""
|
$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"
|
#$DelKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
|
||||||
#$DelValue = "WAU_BypassListForUsers"
|
#$DelValue = "WAU_BypassListForUsers"
|
||||||
$DelKey = ""
|
$DelKey = ""
|
||||||
|
@ -50,7 +51,7 @@ if ($Lnk) {
|
||||||
if ($AddKey -and $AddValue -and $AddTypeData -and $AddType) {
|
if ($AddKey -and $AddValue -and $AddTypeData -and $AddType) {
|
||||||
Add-ModsReg $AddKey $AddValue $AddTypeData $AddType
|
Add-ModsReg $AddKey $AddValue $AddTypeData $AddType
|
||||||
}
|
}
|
||||||
if ($DelKey -and $DelValue) {
|
if ($DelKey) {
|
||||||
Remove-ModsReg $DelKey $DelValue
|
Remove-ModsReg $DelKey $DelValue
|
||||||
}
|
}
|
||||||
if ($DelFile) {
|
if ($DelFile) {
|
||||||
|
|
|
@ -146,7 +146,12 @@ function Add-ModsReg ($AddKey, $AddValue, $AddTypeData, $AddType) {
|
||||||
|
|
||||||
function Remove-ModsReg ($DelKey, $DelValue) {
|
function Remove-ModsReg ($DelKey, $DelValue) {
|
||||||
if (Test-Path "$DelKey") {
|
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
|
Return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue