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 – 2019-09-12T16:50:48.400
Your
Where-Object
compares with the whole collection instead of the currently iterated$app
– LotPings – 2019-09-12T19:37:20.990