0

I used the script from Windows 10: Remove all default apps except specified ones.

Get-AppxPackage -AllUsers | where-object {$_.name –notlike "*store*","*windowscalculator*","*people*"} | Remove-AppxPackage

Got Error Deployment failed with HRESULT: 0x80073CFA.

Remove-AppxPackage : Deployment failed with HRESULT: 0x80073CFA, Removal failed. Please contact your software vendor. (Exception from HRESULT: 0x80073CFA)
error 0x80070032: AppX Deployment Remove operation on package 1527c705-839a-4832-9118-54d4Bd6a0c89_10.0.17134.1_neutral_neutral_cw5n1h2txyewy from:
C:\Windows\SystemApps\Microsoft.Windows.FilePicker_cw5n1h2txyewy failed. This app is part of Windows and cannot be uninstalled on a per-user basis. An administrator can attempt to remove the
app from the computer using Turn Windows Features on or off. However, it may not be possible to uninstall the app.
NOTE: For additional information, look for [ActivityId] 8c1923d8-2299-0001-fb83-198c9922d401 in the Event Log or use the command line Get-AppxLog -ActivityID
8c1923d8-2299-0001-fb83-198c9922d401
At line:1 char:106
+ ... like "*store*","*windowscalculator*","*people*"} | Remove-AppxPackage
+                                                        ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (1527c705-839a-4...l_cw5n1h2txyewy:String) [Remove-AppxPackage], IOException
    + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.RemoveAppxPackageCommand

Remove-AppxPackage : Deployment failed with HRESULT: 0x80073CFA, Removal failed. Please contact your software vendor. (Exception from HRESULT: 0x80073CFA)
error 0x80070032: AppX Deployment Remove operation on package c5e2524a-ea46-4f67-841f-6a9465d9d515_10.0.17134.1_neutral_neutral_cw5n1h2txyewy from:
C:\Windows\SystemApps\Microsoft.Windows.FileExplorer_cw5n1h2txyewy failed. This app is part of Windows and cannot be uninstalled on a per-user basis. An administrator can attempt to remove
the app from the computer using Turn Windows Features on or off. However, it may not be possible to uninstall the app.
NOTE: For additional information, look for [ActivityId] 8c1923d8-2299-0000-8397-198c9922d401 in the Event Log or use the command line Get-AppxLog -ActivityID
8c1923d8-2299-0000-8397-198c9922d401
At line:1 char:106
+ ... like "*store*","*windowscalculator*","*people*"} | Remove-AppxPackage
+                                                        ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (c5e2524a-ea46-4...l_cw5n1h2txyewy:String) [Remove-AppxPackage], IOException
    + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.RemoveAppxPackageCommand

Remove-AppxPackage : Deployment failed with HRESULT: 0x80073CFA, Removal failed. Please contact your software vendor. (Exception from HRESULT: 0x80073CFA)
error 0x80070032: AppX Deployment Remove operation on package E2A4F912-2574-4A75-9BB0-0D023378592B_10.0.17134.1_neutral_neutral_cw5n1h2txyewy from:
C:\Windows\SystemApps\Microsoft.Windows.AppResolverUX_cw5n1h2txyewy failed. This app is part of Windows and cannot be uninstalled on a per-user basis. An administrator can attempt to remove
the app from the computer using Turn Windows Features on or off. However, it may not be possible to uninstall the app.
NOTE: For additional information, look for [ActivityId] 8c1923d8-2299-0000-8c97-198c9922d401 in the Event Log or use the command line Get-AppxLog -ActivityID
8c1923d8-2299-0000-8c97-198c9922d401
At line:1 char:106
+ ... like "*store*","*windowscalculator*","*people*"} | Remove-AppxPackage
+                                                        ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (E2A4F912-2574-4...l_cw5n1h2txyewy:String) [Remove-AppxPackage], IOException
    + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.RemoveAppxPackageCommand

Found solution here

My problem is, If MS do not want me to delete then I don't want to delete. But, if no one has any objection, then I want to delete. Becasue, who knows how many things will break.

So, I do not want to change database or use any hack. I want a script (hopefully an one liner), which will safely delete as much bloatware (Games, 3D Object.., sketch, XBox etc.) as possible.

If removing gives an error, no worries! skip and move to the next app and try to remove it.

2

1 Answer 1

1

Remember, there are always more elegant ways to do things, but this is just an option.

You can just collect all the apps, and compare them against your app whitelist in a loop.

Something like:

"Uninstalling BlackListed apps"
$apps = @(
    # Whitelist Windows 10 apps
    "Microsoft.BingWeather"
    "Microsoft.MicrosoftOfficeHub"
    "Microsoft.Office.OneNote"
    "Microsoft.SkypeApp"
    "Microsoft.WindowsAlarms"
    "Microsoft.WindowsCalculator"
    "Microsoft.WindowsCamera"
    "microsoft.windowscommunicationsapps"
    "Microsoft.WindowsMaps"
    "Microsoft.GetHelp"
    "Microsoft.Messaging"
)

$RemoveAppPkgs = (Get-AppxPackage -AllUsers).Name
'TotalApps: ' + $RemoveAppPkgs.Count
'TotalWhiteListedApps: ' + $apps.Count
'TotalBlackListeedApps: ' + ($RemoveAppPkgs.Count - $apps.Count)

ForEach($TargetApp in $RemoveAppPkgs)
{
    If($apps -notcontains $TargetApp)
    {
        Write-Output "Trying to remove $TargetApp"
    }
}

Output:

Uninstalling BlackListed apps
TotalApps: 141
TotalWhiteListedApps: 11
TotalBlackListeedApps: 130
Trying to remove Windows.PrintDialog
Trying to remove Microsoft.NET.Native.Framework.1.0
Trying to remove Microsoft.NET.Native.Framework.1.0
Trying to remove Microsoft.NET.Native.Framework.1.1
Trying to remove Microsoft.NET.Native.Framework.1.1
Trying to remove Microsoft.NET.Native.Framework.1.6
Trying to remove Microsoft.NET.Native.Framework.1.6
Trying to remove Microsoft.NET.Native.Runtime.1.0
Trying to remove Microsoft.NET.Native.Runtime.1.0
Trying to remove Microsoft.NET.Native.Runtime.1.1
Trying to remove Microsoft.NET.Native.Runtime.1.1
Trying to remove Microsoft.NET.Native.Runtime.1.6
Trying to remove Microsoft.NET.Native.Runtime.1.6
Trying to remove Microsoft.VCLibs.120.00
Trying to remove Microsoft.VCLibs.120.00
...


As noted in the pointer you reference, there are packages you just can't uninstall:

# apps which cannot be removed using Remove-AppxPackage
#"Microsoft.BioEnrollment"
#"Microsoft.MicrosoftEdge"
#"Microsoft.Windows.Cortana"
#"Microsoft.WindowsFeedback"
#"Microsoft.XboxGameCallableUI"
#"Microsoft.XboxIdentityProvider"
#"Windows.ContactSupport"

If there are others with this issue, you just need to trap and skip them (using if/then or a try/catch block).

* Update as per OP request * Just add back the code from your post link to have the remove happen.

ForEach($TargetApp in $RemoveAppPkgs)
{
    If($apps -notcontains $TargetApp)
    {
        "Trying to remove $TargetApp"

        Get-AppxPackage -Name $TargetApp -AllUsers | Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue

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

Or, add the apps know you can't remove to the whitelist and you should get no errors to deal with.

However, anytime you are doing something destructive like this, you should have error handling. I would also suggest you use the -whatif switch as a precaution on that remove stuff before you do this for real. Just to be sure you are really getting what you'd expect.

As for try / catch example. If you are in the PowerShell_ISE, just hit CRTL+J to pull up the snippet list and select a try/catch template to use.

3
  • can you please provide the example with try-catch as well?
    – user329172
    Commented Jul 24, 2018 at 8:44
  • I think it only echoes "Trying to remove $TargetApp". Can you please fix it so that it uninstalls as well.
    – user329172
    Commented Jul 24, 2018 at 8:49
  • 1
    8^} I did the send to the screen this only, of course because I did not want to remove apps from my system. 8^} As far as the remove part you just add back in the code block from the pointer you posted. All I did was take that code and modify it as per my suggestion. Even if you did not want to use if/then or try/catch, you could just use the -ErrorAction SilentlyContinue approach to ignore errors on the remove cmdlet. Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue.
    – postanote
    Commented Jul 25, 2018 at 0:17

You must log in to answer this question.