1

I'm trying to make my own de-bloat script that will remove both provisioned and user apps from Windows 10. I've made a list of the provisioned apps using this command Get-AppXProvisionedPackage -Online | Select DisplayName and filtered it out to show the displayname of each app. In the code below I'm trying to place each listed app into the command below so that I have got to write it out multiple times. Could someone explain where I'm going wrong please?

P.S I'm extremely new to PowerShell.

# This script de-bloats unwanted apps from Windows 10.
# To keep certain apps insert a '#' at the beginning of the line 
# and it will be skipped from being removed. 

Write-Output "Uninstalling provisioned apps"
$ProvisionedApps = @(
    "Microsoft.BingWeather"
    #"Microsoft.DesktopAppInstaller"
    "Microsoft.GetHelp"
    "Microsoft.Getstarted"
    #"Microsoft.HEIFImageExtension"
    "Microsoft.Messaging"
    "Microsoft.Microsoft3DViewer"
    "Microsoft.MicrosoftOfficeHub"
    "Microsoft.MicrosoftSolitaireCollection"
    #"Microsoft.MicrosoftStickyNotes"
    "Microsoft.MixedReality.Portal"
    #"Microsoft.MSPaint"
    #"Microsoft.Office.OneNote"
    "Microsoft.OneConnect"
    "Microsoft.People"
    "Microsoft.Print3D"
    "Microsoft.ScreenSketch"
    #"Microsoft.SkypeApp"
    #"Microsoft.StorePurchaseApp"
    #"Microsoft.VP9VideoExtensions"
    "Microsoft.Wallet"
    #"Microsoft.WebMediaExtensions"
    #"Microsoft.WebpImageExtension"
    #"Microsoft.Windows.Photos"
    #"Microsoft.WindowsAlarms"
    #"Microsoft.WindowsCalculator"
    #"Microsoft.WindowsCamera"
    "microsoft.windowscommunicationsapps"
    "Microsoft.WindowsFeedbackHub"
    #"Microsoft.WindowsMaps"
    #"Microsoft.WindowsSoundRecorder"
    #"Microsoft.WindowsStore"
    "Microsoft.Xbox.TCUI"
    "Microsoft.XboxApp"
    "Microsoft.XboxGameOverlay"
    "Microsoft.XboxGamingOverlay"
    "Microsoft.XboxIdentityProvider"
    "Microsoft.XboxSpeechToTextOverlay"
    "Microsoft.YourPhone"
    "Microsoft.ZuneMusic"
    "Microsoft.ZuneVideo"
)

foreach ($app in $ProvisionedApps) {
    Write-Output "REMOVING $app"

    Get-AppXProvisionedPackage -Online | Where-Object DisplayName -EQ $ProvisionedApps | Remove-AppxProvisionedPackage -Online
}

Many thanks

Will

  • Welcome. What error are you getting? Please make your title reflect your question/problem. – I say Reinstate Monica Sep 12 '19 at 16:50
  • Your Where-Object compares with the whole collection instead of the currently iterated $app – LotPings Sep 12 '19 at 19:37
0

You may consult the detailed debloating PowerShell script at Windows10-Unbloating-v1.ps1.

The actual code used (I changed variable names to yours) is:

foreach ($app in $ProvisionedApps) {
    Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -AllUsers
    Get-AppXProvisionedPackage -Online | Where-Object DisplayName -EQ $app | Remove-AppxProvisionedPackage -Online
}

You will notice in the Get-AppXProvisionedPackage command the use of the $app variable instead of $ProvisionedApps.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.