From acda2ee1066ed9493c8dffab5e1ce7494e1bb8e5 Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Fri, 16 Feb 2018 20:02:50 -0800 Subject: [PATCH] Fixed whitelisted apps being removed I fixed the issue where the whitelisted apps were being removed. I then changed the conditional operator on lines 22-25, and lines 36-39, from -notlike to -notcontains. I also removed the asterisks from the AppXPackage/AppXProvisionedPackage names which results in the whitelisting working appropriately. The whitelisted apps are no longer being removed. --- Windows10SilentDebloater.ps1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Windows10SilentDebloater.ps1 b/Windows10SilentDebloater.ps1 index 45e7bf6..8098f27 100644 --- a/Windows10SilentDebloater.ps1 +++ b/Windows10SilentDebloater.ps1 @@ -25,18 +25,18 @@ Function Start-Debloat { #Removes AppxPackages Get-AppxPackage -AllUsers | - Where-Object {$_.name -notlike "*Microsoft.Paint3D"} | - Where-Object {$_.name -notlike "*Microsoft.WindowsCalculator*"} | - Where-Object {$_.packagename -notlike "*Microsoft.WindowsStore*"} | - Where-Object {$_.packagename -notlike "*Microsoft.Windows.Photos*"} | + Where-Object {$_.name -notcontains "Microsoft.Paint3D"} | + Where-Object {$_.name -notcontains "Microsoft.WindowsCalculator"} | + Where-Object {$_.name -notcontains "Microsoft.WindowsStore"} | + Where-Object {$_.name -notcontains "Microsoft.Windows.Photos"} | Remove-AppxPackage -ErrorAction SilentlyContinue - + #Removes AppxProvisionedPackages Get-AppxProvisionedPackage -online | - Where-Object {$_.packagename -notlike "*Microsoft.Paint3D*"} | - Where-Object {$_.packagename -notlike "*Microsoft.WindowsCalculator*"} | - Where-Object {$_.packagename -notlike "*Microsoft.WindowsStore*"} | - Where-Object {$_.packagename -notlike "*Microsoft.Windows.Photos*"} | + Where-Object {$_.packagename -notcontains "Microsoft.Paint3D"} | + Where-Object {$_.packagename -notcontains "Microsoft.WindowsCalculator"} | + Where-Object {$_.packagename -notcontains "Microsoft.WindowsStore"} | + Where-Object {$_.packagename -notcontains "Microsoft.Windows.Photos"} | Remove-AppxProvisionedPackage -online -ErrorAction SilentlyContinue }