Sycnex / Windows10Debloater

Script to remove Windows 10 bloatware.
MIT License
18.22k stars 2.04k forks source link

The Store, Calculator, and Photos are being removed #5

Closed abulgatz closed 6 years ago

abulgatz commented 6 years ago

Despite the exception in the script, the Store, Calculator, and Photos are being removed.

I don't understand why, but adding these lines to the end of the script brings them back:

Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
klxz79 commented 6 years ago

I can confirm this. I use this tool a lot and just recently it started removing these apps too. It's done it on the 2 new HP PCs I've worked on this week.

I created this Github account just so I could comment on this.

Sycnex commented 6 years ago

Thanks for the heads up. I'll be putting in some time this Sunday to see if I can fix the issue.

The Revert-Changes function actually utilizes the code Abulgatz mentioned to bring back any AppXPackages/AppXProvisionedPackages. Something must have changed with Microsoft's latest update, 1709.

Oddly enough, I don't have the same issue that you both have on my VMs or physical Windows 10 machines. The script works as it should for myself.

Have either of you found a specific way to stop those apps from being removed? I'm just looking for some insight.

klxz79 commented 6 years ago

I'm seeing this issue on 1703. Both PCs are brand new HPs so they're still coming with 1703 and haven't been updating to 1709 yet.

The revert-changes does bring them back

klxz79 commented 6 years ago

Unfortunately I'm not a programmer just an average IT guy. But maybe their packagename changed?

I'll revert changes and check package names

Sycnex commented 6 years ago

I'm an average IT guy as well!

I looked at the package names and it looks like they haven't been changed. I was hoping it'd be a simple fix like that.

I'll use Abulgatz's code that he/she shared and see if I can use it in a form of a "check", so that if they are removed the script can automatically add them back.

When did it start? With a recent Windows update, perhaps?

klxz79 commented 6 years ago

The PC I'm sitting at right now is brand new and the only updates installed was during initial setup and that's KB4035543 a 07/17 quality update and KB4073543 which updates the updater I think. The package names look the same.

My guess is it started this week, I use this almost everyday and I think I noticed it tuesday or wednesday.

Sycnex commented 6 years ago

Interesting. Thanks for the extra information. I'll be looking further into this because I'd like to fix it so that it doesn't continue to happen.

I may end up moving to using Blacklisting instead of Whitelisting.

Sycnex commented 6 years ago

Hello,

In my latest commit you will see that 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. This results in the whitelisting working appropriately. I have done the testing on my own physical machine and some VMs I had.

I did try running the code before I changed it and I did happen to experience what you both experienced. That is no longer the case.

Please let me know if that resolved it for you.

onurakturk commented 6 years ago

Hello,

Thanks for the script, great work but it doesn't work properly on my build. I'm building 1709 with Audit mode. Script works Administrator account but it removed Store, Calculator, and Photos app on new user accounts.

Sycnex commented 6 years ago

Thanks for the additional information. I will try changing the Start-Debloat function tomorrow and see if I can fix it once and for all. I have absolutely no idea why it is doing this for you all. If anyone can think of anything then please feel free to add in what you think might work.

I might add in a check that checks if the store, calculator, and photos have been removed and if so it will add them back.

JeffChristie commented 6 years ago

Morning Sycnex,

I'm using Audit mode to create a new staging image for Windows 10 1709 and using either the silent or interactive versions of the script removes the Store, Photos, Paint3d, and Calculator apps.

Running Revert doesn't bring them back. I'm going to deploy to a workstation and see if a user account brings them back, I'll report back asap.

Let me know if I can help with getting this sorted.

Thanks,

Jeff

Sycnex commented 6 years ago

Hi Jeff,

Try running the following code provided by @abulgatz to get the missing packages back:

Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
abulgatz commented 6 years ago

I'm not sure exactly when this started having issues, but I think it's been at least a month. I run a computer repair business and I've used your script on many computers from many manufacturers, and I remember starting to have problems a month or a month and a half ago.

I tried messing with the package names and wasn't able to prevent removal, so I just added the Add-AppxPackage lines I included at the top of this issue report to my version of the script, which seems to work fine, but is not an elegant solution.

One of the reasons I like your script is because it uses on whitelist instead of a blacklist, because otherwise it's a constant game of wack-a-mole with Microsoft's ever increasing number of junkware apps.

Sycnex commented 6 years ago

I am not so sure as to what has changed, but Microsoft loves to change things without a notification or changelog. I added your code to my script in the form of a function which checks to see if the whitelisted apps were removed and if so it re-adds them. I am hoping that the function will be temporary, but perhaps it'll stay permanently. I gave you credit for it as well.

Thank you. Yes that's why I decided to go the Whitelisted route, as I was finding that blacklisting was not always overly effective and you had to search for each and every package name.

Please give the new updated version a try and let me know how it works.

jasonpohl1 commented 6 years ago

Hi Sycnex,

I just wanted to thank you for the script. I will be running the newly updated version tomorrow and update if I find any issues.

Sycnex commented 6 years ago

Hi Jasonpohl1,

You're most welcome! Please let me know if it worked for you.

jasonpohl1 commented 6 years ago

error

So I ran the script, but get the error I have to enable script running (LOL). I won't have time to do that today, but I wanted to update. I will get more time tomorrow and circle back.

abulgatz commented 6 years ago

Set-ExecutionPolicy Unrestricted

Make sure to run the above command and the script itself as an administrator.

On Feb 21, 2018, at 4:35 PM, Jason P. notifications@github.com wrote:

So I ran the script, but get the error I have to enable script running (LOL). I won't have time to do that today, but I wanted to update. I will get more time tomorrow and circle back.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Sycnex commented 6 years ago

Hello,

Any updates/luck with the new commits?

jasonpohl1 commented 6 years ago

Hi, I'm getting the attached, but to be honest I haven't quite figured out what this error means error2

Sycnex commented 6 years ago

Hi Jason,

I see now. Interestingly I didn't run into that same error when running the script. Are you running that script in the text window or running the file directly itself?

It looks to me as though you're running the file directly, not the text.

Is this the latest version of the script?

On Feb 23, 2018 8:48 AM, "Jason P." notifications@github.com wrote:

Hi, I'm getting the attached, but to be honest I haven't quite figured out what this error means [image: error2] https://user-images.githubusercontent.com/5865673/36605670-39bb766c-1876-11e8-9163-36bc027dcf41.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Sycnex/Windows10Debloater/issues/5#issuecomment-368066228, or mute the thread https://github.com/notifications/unsubscribe-auth/AHCc4AMCIM_iNvQbxGrX8uLY4bxmgsxHks5tXuu3gaJpZM4SDQzl .

klxz79 commented 6 years ago

I think you're doing it wrong. You don't double-click on the ps1 file to run it, that opens the PS editor, you don't want to do that. You run it from a powershell prompt.

Navigate to the folder the scripts are in.
Click file and choose to open powershell here as administrator.
Then run set-executionpolicy remotesigned, then choose yes.
Then type Windows10Debloater.ps1 into the administrator powershell window and press enter.

That's how you run powershell scripts. You don't doubl-click them like they're .bat files

jasonpohl1 commented 6 years ago

Thanks guys, it most likely is user error, I haven't scripted since Win7 so I am getting back up to speed.

I am used to right clicking and run-as administrator but I don't get that option now.

I'm downloading the script again to make sure it's the latest version

Thanks again everyone!!

klxz79 commented 6 years ago

I just tested that latest version of the script on Build 1703 and I didn't have any issues. This was on a fresh install of Build 1703 on a new SSD, no OEM customizations just plain old 1703 from Microsoft.

Sycnex commented 6 years ago

Thank you for testing it. I will go ahead and close this issue.