I removed the switch containing interactive/noninteractive choices since the noninteractive option only cut down the amount of interactive prompts by 2, and I saw no value with keeping it. I also fixed the formatting of the code and it should be a bit more presentable now.
I added a new Function called FixWhitelistedApps, which will check to see if any of the Whitelisted Apps were removed, and if so it should re-add them.
I then changed the code in the function Start-Debloat, given to me by Reddit user /u/GavinEke.
I changed the Start-Debloat Function's code to use [regex] as explained in the following link: https://www.reddit.com/r/PowerShell/comments/7xzwah/4_whitelisted_apps_in_my_script_are_being_removed/\
Thanks to Reddit user /u/GavinEke for the help.
I added a new Function called FixWhitelistedApps which will run and check to see if the Whitelisted apps in the Start-Debloat function were removed, and if so it should bring them back.
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.
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.
I added a $SysPrep switch parameter and function on lines 7 - 17. This will run the following command: get-appxpackage | remove-appxpackage. This is required in order to be used successfully with SysPrep.
I also added a $StopEdgePDF parameter, for those who do not wish to stop Edge from being used as the default PDF viewer, or for those who worry about unintended consequences (not being able to potentially choose Edge without removing the specified registry keys).
You can now run the script with the switch parameter -SysPrep, along with -Debloat, and -StopEdgePDF.
I changed the $_.name on lines 24, 25, 32, and 33 to $_.packagename since the whitelisted apps "Photos" and "Store" were still being removed.
Now they shouldn't be removed.
I changed the $_.name on lines 24, 25, 32, and 33 to $_.packagename since the whitelisted apps "Photos" and "Store" were still being removed.
Now they shouldn't be removed.
On line 410 if you chose to run Interactively and wanted to Revert changes it would tell you that the Revert switch statement was not recognized. This is now fixed.
On line 450 if you chose to use the Noninteractive method it wasn't recognized. This is now fixed as well.
Upon launching the script you will see that the script will create a folder called Windows10Debloater which it will use to store logs. If it detects that it has already been created previously then it will tell you that the folder already exists. The path will be: C:\Windows10Debloater
I added logging. It will record a transcript of your session and then output the transcript file into C:\Windows10Debloater. These can be used for troubleshooting or if you get error messages.
I added a Noninteractive switch so that instead of you choosing between "Interactive" and "Silent" it will only ask you 1 question, instead of the "Interactive" one asking you a couple of questions.
The "Interactive" switch doesn't automatically reboot your machine.