cleanup reg install location when reverting custom package

This commit is contained in:
zoicware
2025-12-27 12:53:52 -05:00
committed by GitHub
parent 0d989dedd2
commit 9cbed1156f

View File

@@ -712,6 +712,14 @@ function Install-NOAIPackage {
catch {
dism.exe /Online /remove-package /PackageName:$($package.PackageName) /NoRestart
}
#remove reg install location
$regPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages'
Get-ChildItem $regPath | ForEach-Object {
$value = try { Get-ItemProperty "registry::$($_.Name)" -ErrorAction Stop } catch { $null }
if ($value -and $value.PSPath -like '*zoicware*') {
Remove-Item -Path $value.PSPath -Recurse -Force
}
}
}
else {