Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Fix a typo in WhitelistedApps String that prevents it from working properly #485

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

oboudry
Copy link

@oboudry oboudry commented Jan 13, 2022

The backquote in the string does not have the anticipated effect of joining the multiple lines. It's taken as a character and prevent some parts of the regular expression from being executed. With this fix the FixWhitelistedApps run is most probably useless as they won't be removed.

…softStickyNotes and Microsoft.VP9VideoExtensions to be interpreted as whitelisted apps.

The backquote cannot be used inside the string and is interpreted as a character of the regular expression. Because of this two whitelisted apps are not recognized as such. I suppose with this change, the FixWhitelistedApps reinstallation that occurs at the end of the script could be removed as it's no longer needed.
Fix a syntax error in $WhitelistedApps which prevents Microsoft.Micro…
@tort-oise
Copy link

Hm.. I see. This is why the whitelist had issues. Great pull, might work.

@isidroco
Copy link

isidroco commented Mar 15, 2022

As an improvement you can use smaller regex code, and use \. instead of . (which is any char). Adding suggested from w11 in #453 and Xaml, VCLibs. And more important, filter out all System apps which speeds up a lot:

[regex]$WhitelistedApps = "ScreenSketch|Paint3D|WindowsCalculator|WindowsStore|Windows\.Photos|UbuntuonWindows|" `
  + "StickyNotes|MSPaint|WindowsCamera|\.NET|HEIFImageExtension|ScreenSketch|StorePurchaseApp|" `
  + "VP9VideoExtensions|WebMediaExtensions|WebpImageExtension|DesktopAppInstaller|" `
  + "MixedReality|Nvidia|Slack|\.Paint|VCLibs|WindowsNotepad|WindowsTerminal|Xaml"
Get-AppxPackage -AllUsers |
  Where-Object {$_.Name -NotMatch $WhitelistedApps -and $_.SignatureKind -ne "System"} | 
  Remove-AppxPackage -ErrorAction SilentlyContinue
# Run this again to avoid error on 1803 or having to reboot.
Get-AppxPackage -AllUsers |
  Where-Object {$_.Name -NotMatch $WhitelistedApps -and $_.SignatureKind -ne "System"} |
  Remove-AppxPackage -ErrorAction SilentlyContinue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants