The application will now write to the host console properly and give updates as it does its work instead of just hanging and acting as if it is frozen. The $RemoveAllBloatware Add_Click now works properly as well as $RemoveBlacklist and the associated Add_Click.
The console will put a space in between lines when each Add_Click action is finished for better reading and font visibility.
This is my test file that I have been working with. I am currently creating a GUI for all of the code in this Repository and am working to make it function appropriately. It isn't completely functioning as intended, so before you use it on machines you care about, please make sure you understand that this is in development and I cannot guarantee that things won't break. Also make sure to make a backup.
& sc config InstallService start=disabled -> Gave me an error, used power shell command and it worked without errors
re-run line 41 in order to avoid error or having to reboot.
I removed the code from line 15 as this will wipe more than the target appxpackages/appxprovisionedpackages since even some games/apps/etc from the Microsoft Store and others that are wanted will be removed.
I added a new blacklist function called DebloatBlacklist which will only remove the specified bloatware in the array in the function.
I also renamed the Start-Debloat function to DebloatAllApps since it seemed to remove absolutely everything related to the Microsoft Store (Any games, apps, etc).
When you hit "Yes" in the first prompt, you will be asked if you want debloat via a blacklist or if you want to remove everything, in terms of apps.
I removed the line of code get-appxpackage | remove-appxpackage from the Begin-SysPrep function because it was accidentally removing all packages.
I also removed the If statement in the FixWhitelistedApps since it wasn't necessary.
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.