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.
This commit is contained in:
Richard Newton 2018-02-16 20:02:50 -08:00 committed by GitHub
parent 542619fa87
commit acda2ee106
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}