2

I'm trying to debloat Windows 10 Education by running the following commands in a powershell script. I can get the script to remove the apps for the logged in user but as soon as someone new logs in, the apps reappear.

Here is my script:

Get-AppxPackage -AllUsers | where-object {$_.name –like “*3DBuilder*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowsalarms*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowscamera*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowscommunicationsapps*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*officehub*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*getstarted*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowsmap*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*solitairecollection*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*bingfinance*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*bingnews*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*zunevideo*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*people*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowsphone*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*bingsports*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowsstore*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*soundrecorder*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*bingweather*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*xboxapp*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*Appconnector*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*MinecraftUWP*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*Messaging*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*WindowsFeedbackHub*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*Getstarted*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*GetHelp*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*ContactSupport*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*Wallet*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*OneConnect*”} | Remove-AppxPackage

Any advice would be much appreciated.

arco444
  • 22,002
  • 12
  • 63
  • 67
Andy_G
  • 23
  • 4

2 Answers2

3

I'm not 100% sure but I think you need to use the -Online parameter

$Apps = Get-AppxProvisionedPackage -Online
$Apps | Where-Object {$_.DisplayName -like "*windowscommun*"} | Remove-AppxProvisionedPackage -Online
Olaf Reitz
  • 684
  • 3
  • 10
  • Thanks Olaf I will try this version too. – Andy_G Aug 15 '17 at 12:23
  • 1
    This answer is correct because of the difference between `Get-AppxProvisionedPackage` and `Get-AppxPackage`. AppxPackage get packages that are already installed, AppxProvisionedPackage gets packages in the repository. If it's a freshly image before anyone logs in then you can just use AppxProvisionedPackage, but if users have logged in both will need to be used. – BenH Aug 15 '17 at 13:23
-1

You've got the -AllUsers switch set on Get-AppxPackage, but not on Remove-AppxPackage. If you do add it to the end of each line, you should get the expected behavior. Note that I don't think you need the first AllUsers switch, but it can't hurt to keep it in (excluding that it'll probably make the commands take longer to complete.)

Get-AppxPackage -AllUsers | where-object {$_.name –like “*3DBuilder*”} | Remove-AppxPackage -AllUsers
Windos
  • 1,796
  • 1
  • 13
  • 19