I fixed a bug that was forcing the script to either hang or to completely kill the PowerShell Session in VSCode. I removed any variables that were added in the code but never declared called $PublishSettings.
The script runs properly now and no longer kills the PowerShell session or hangs.
I added code to create a new PSDrive for HKCR so that the function can access the portion of the registry associated with HKCR and create/modify the specific registry keys.
I believe this resolves the function from hanging.
Mostly getting rid of redundant code that was doing the same thing over top of itself (ex: NewItemProperty with a value and then next line set the exact same value??)
Also added some more that was missed with telemetry, bing in the start menu, disabling cortana completely, and fully removing OneDrive and removed it from the side bar in explorer.
Added an admin check to see if the script is running with admin right, if it isn't then it'll close and reopen with admin right and continue on.
Also added a GUI to replace the need for "read-host" to get a response from USER
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 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 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 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.