1
0 Comments

I’m a novice in PowerShell, and I’m attempting to create a custom script that can eliminate both user-installed and provisioned apps from Windows 10. To accomplish this, I used the command “Get-AppXProvisionedPackage -Online | Select DisplayName” to generate a list of the provisioned apps and filtered it to display the name of each app.

However, I’m facing difficulties in putting each app’s name into the command below, which is causing me to write it out repeatedly. Can someone please guide me on where I’m making a mistake?

# 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
}

Thanks

Askify Moderator Edited question April 26, 2023