Fix Remove-AI-CBS-Packages operator precedence corrupting component store - #234
Open
snowzhangy wants to merge 1 commit into
Open
Fix Remove-AI-CBS-Packages operator precedence corrupting component store#234snowzhangy wants to merge 1 commit into
snowzhangy wants to merge 1 commit into
Conversation
…k packages The visibility check (Visibility -eq 2) was only scoped to the AIX pattern due to missing parentheses, so PSChildName -like '*Recall*'/'*Copilot*'/'*CoreAI*' matched any CBS package regardless of whether it was actually hidden. Combined with this function manually stripping a package's Owners/Updates registry subkeys before forcing removal (bypassing DISM's normal dependency tracking), a hidden CBS package sharing WinSxS payloads with other components could take those shared files down with it. On a Windows 11 25H2 test machine this corrupted ~605 component-store files and crashed TextInputHost.exe (touch keyboard/handwriting panel host, now shipped in the MicrosoftWindows.Client.CBS package) on every launch with 0xc0000409 in Windows.UI.Xaml.dll. Confirmed root cause via DISM/SFC logs showing "Total Repaired Corruption: 605" right after this function ran, and fixed only after a DISM RestoreHealth + reboot repaired the component store. This adds the missing parens so all four name patterns require Visibility -eq 2 as originally intended, adds an explicit exclude list for CBS/text-input packages so they can never be matched by this removal path even if hidden, and drops the now-unnecessary 'InpApp' match from the two $aipackages arrays (MicrosoftWindows.Client.InputApp is the touch keyboard host on older builds and shouldn't be targeted either).
zoicware
added a commit
that referenced
this pull request
Aug 23, 2026
Owner
|
a few things:
Without paren With paren
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove-AI-CBS-Packages's visibility check (Visibility -eq 2) was only scoped to the*AIX*pattern due to missing parentheses (-andbinds tighter than-or), so*Recall*/*Copilot*/*CoreAI*matched any CBS package by name regardless of whether it was actually hidden.Owners/Updatesregistry subkeys before forcing removal viaRemove-WindowsPackage/DISM, which bypasses the normal dependency-tracking safety net Windows servicing relies on.Total Repaired Corruption: 605right after this function ran) and brokeTextInputHost.exe— the touch keyboard/handwriting panel host, shipped in theMicrosoftWindows.Client.CBSpackage on this build — which then crashed on every launch with0xc0000409inWindows.UI.Xaml.dll. Fix requiredDISM /RestoreHealthwith matching install media + a reboot.InpApppattern from both$aipackagesarrays —MicrosoftWindows.Client.InputAppis the touch keyboard host package on older Windows builds and shouldn't be targeted by AI removal either.Changes
Visibility -eq 2as originally intended, narrowing the removal back to genuinely hidden packages.Client.CBS,TextInput,InputApp,Client.CBSPreview) so packages backing the text-input/touch-keyboard stack can never be matched by this removal path, even if hidden.InpAppfrom both$aipackagesarrays.Test plan
TextInputHost.exestill launches normally after running the script.