From d40cd34349877032e41529bb1a84db6dc7165df5 Mon Sep 17 00:00:00 2001 From: zoicware <118035521+zoicware@users.noreply.github.com> Date: Sun, 30 Nov 2025 01:15:52 -0500 Subject: [PATCH] ignore error fix #53 --- RemoveWindowsAi.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RemoveWindowsAi.ps1 b/RemoveWindowsAi.ps1 index d7582ee..ce4dcc7 100644 --- a/RemoveWindowsAi.ps1 +++ b/RemoveWindowsAi.ps1 @@ -1064,7 +1064,7 @@ function Remove-AI-CBS-Packages { $regPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages' $ProgressPreference = 'SilentlyContinue' Get-ChildItem $regPath | ForEach-Object { - $value = Get-ItemPropertyValue "registry::$($_.Name)" -Name Visibility + $value = try { Get-ItemPropertyValue "registry::$($_.Name)" -Name Visibility -ErrorAction SilentlyContinue } catch {} if ($value -eq 2 -and $_.PSChildName -like '*AIX*' -or $_.PSChildName -like '*Recall*' -or $_.PSChildName -like '*Copilot*' -or $_.PSChildName -like '*CoreAI*') { Set-ItemProperty "registry::$($_.Name)" -Name Visibility -Value 1 -Force New-ItemProperty "registry::$($_.Name)" -Name DefVis -PropertyType DWord -Value 2 -Force