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
3 Answers
Introduction
Windows 10 comes with a lot of pre-installed apps that some users might not want or need. These apps can take up valuable disk space, slow down your computer, and even collect data without your consent. Fortunately, PowerShell provides a way to remove these unwanted apps from your system, both the ones installed by users and the ones provisioned by Microsoft.
In this blog post, we will guide you through the process of creating a custom script that can eliminate both user-installed and provisioned apps from Windows 10. We will also show you how to use the Get-AppXProvisionedPackage
command to generate a list of the provisioned apps and filter it to display the name of each app.
Removing User-Installed Apps
The first step in removing user-installed apps is to generate a list of all the apps installed on your computer. To do this, open PowerShell as an administrator and run the following command:
Get-AppxPackage -AllUsers | Select Name
This will display a list of all the apps installed on your computer. To remove an app, you need to know its name. Once you have the name of the app you want to remove, run the following command:
Get-AppxPackage -AllUsers | where-object {$_.name -eq "NameOfApp"} | Remove-AppxPackage
Replace “NameOfApp” with the name of the app you want to remove. This command will remove the app from your computer.
Removing Provisioned Apps
Provisioned apps are the pre-installed apps that come with Windows 10. To remove these apps, you need to generate a list of all the provisioned apps on your computer. To do this, run the following command in PowerShell:
Get-AppXProvisionedPackage -Online | Select DisplayName
This command will generate a list of all the provisioned apps on your computer. To remove a provisioned app, you need to add its name to a list in your script. Here’s an example script that removes several provisioned apps:
$ProvisionedApps = @(
"Microsoft.BingWeather"
"Microsoft.GetHelp"
"Microsoft.Getstarted"
"Microsoft.Messaging"
"Microsoft.Microsoft3DViewer"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.MicrosoftSolitaireCollection"
"Microsoft.MixedReality.Portal"
"Microsoft.OneConnect"
"Microsoft.People"
"Microsoft.Print3D"
"Microsoft.ScreenSketch"
"microsoft.windowscommunicationsapps"
"Microsoft.WindowsFeedbackHub"
"Microsoft.Xbox.TCUI"
"Microsoft.XboxApp"
"Microsoft.XboxGameOverlay"
"Microsoft.XboxGamingOverlay"
"Microsoft.XboxIdentityProvider"
)
Write-Output "Uninstalling provisioned apps"
foreach ($App in $ProvisionedApps) {
Get-AppxProvisionedPackage -Online | where-object {$_.DisplayName -eq $App} | Remove-AppxProvisionedPackage -Online
}
In this script, we have created an array called $ProvisionedApps
that contains the names of the provisioned apps we want to remove. We then use a foreach
loop to iterate through the array and remove each app using the Get-AppxProvisionedPackage
and Remove-AppxProvisionedPackage
commands.
Keeping Certain Apps
If you want to keep certain apps, you can add a “#” at the beginning of the line in the script to skip them from being removed. For example, if you want to keep the “Microsoft.WindowsCalculator” app, you can modify the script as follows:
$ProvisionedApps = @(
"Microsoft.BingWeather"
"Microsoft.GetHelp"
"Microsoft.Getstarted"
"Microsoft.Messaging"
"Microsoft.Microsoft3DViewer"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.MicrosoftSolitaireCollection"
"Microsoft.MixedReality.Portal"
"Microsoft.OneConnect"
"Microsoft.People"
"Microsoft.Print3D"
"Microsoft.ScreenSketch"
"microsoft.windowscommunicationsapps"
"Microsoft.WindowsFeedbackHub"
#"Microsoft.WindowsCalculator"
"Microsoft.Xbox.TCUI"
"Microsoft.XboxApp"
"Microsoft.XboxGameOverlay"
"Microsoft.XboxGamingOverlay"
"Microsoft.XboxIdentityProvider"
)
Write-Output "Uninstalling provisioned apps"
foreach ($App in $ProvisionedApps) {
if ($App -notlike "#*") {
Get-AppxProvisionedPackage -Online | where-object {$_.DisplayName -eq $App} | Remove-AppxProvisionedPackage -Online
}
}
In this modified script, we have added a “#” at the beginning of the line for the “Microsoft.WindowsCalculator” app to skip it from being removed. We have also added an if
statement to check if the app name does not start with “#”, and only remove the app if it meets this criterion.
Conclusion
Removing unwanted apps from Windows 10 can help free up disk space, improve performance, and protect your privacy. With PowerShell, you can easily remove both user-installed and provisioned apps from your system. In this blog post, we have shown you how to generate a list of all the installed and provisioned apps on your computer and remove them using PowerShell commands. We have also provided an example script that you can modify to remove the provisioned apps that you don’t want.
It looks like you are trying to remove a list of provisioned apps from Windows 10 using a script. In the script, you are using a foreach
loop to iterate over the list of apps stored in the $ProvisionedApps
array.
For each app in the list, you are attempting to remove the app using the Remove-AppxProvisionedPackage
cmdlet. However, there is an issue with the Where-Object
cmdlet that you are using to filter the list of provisioned apps.
Currently, you are passing the entire $ProvisionedApps
array as the value for the DisplayName
parameter of the Where-Object
cmdlet, which is not correct. You should instead pass the $app
variable that is being iterated over in the foreach
loop.
Here is the corrected code:
foreach ($app in $ProvisionedApps) {
Write-Output "REMOVING $app"
Get-AppXProvisionedPackage -Online | Where-Object DisplayName -EQ $app | Remove-AppxProvisionedPackage -Online
}
This will correctly filter the list of provisioned apps to only include the app being iterated over in the foreach
loop, and remove it using the Remove-AppxProvisionedPackage
cmdlet.
I hope this helps! Let me know if you have any questions.
The PowerShell script for removing unnecessary elements can be found in detail at “Windows10-Unbloating-v1.ps1“. The code utilized in the script has been adjusted to incorporate variable names similar to yours:
foreach ($app in $ProvisionedApps) {
Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -AllUsers
Get-AppXProvisionedPackage -Online | Where-Object DisplayName -EQ $app | Remove-AppxProvisionedPackage -Online
}
When looking at the Get-AppXProvisionedPackage
command, you may observe that the $app
variable is employed instead of $ProvisionedApps
.