I fixed an issue where the whitelisted apps; Paint3D, Calculator, Store, and Photos were being removed.
I changed the conditional operator from -notlike to -notcontains on lines 22-25, and lines 30-33. Then, I removed the asterisks from each AppXPackage/AppXProvisionedPackage name.
The issue of the whitelisted apps being removed should no longer be the case.