From 9cbed1156f3b2da0f4d8d0801c6e12ca124ad7cc Mon Sep 17 00:00:00 2001 From: zoicware <118035521+zoicware@users.noreply.github.com> Date: Sat, 27 Dec 2025 12:53:52 -0500 Subject: [PATCH] cleanup reg install location when reverting custom package --- RemoveWindowsAi.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RemoveWindowsAi.ps1 b/RemoveWindowsAi.ps1 index 90fc225..bf447be 100644 --- a/RemoveWindowsAi.ps1 +++ b/RemoveWindowsAi.ps1 @@ -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 {