Remove all Default Apps Except few Using Powershell - Error: Deployment failed with HRESULT: 0x80073CFA

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.

powershell
asked on Super User Jul 23, 2018 by (unknown user)

1 Answer

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.

answered on Super User Jul 24, 2018 by postanote • edited Jul 25, 2018 by postanote

User contributions licensed under CC BY-SA 3.0