0

I just started using powershell and i want to write basic shell script to delete Windows 10 defaults apps,, like XBOX,Instagram and others, this is how my script looks like.

$appXPackage = "Get-AppXPackage -Name"
$appXPackage + ' Microsoft.XboxGameCallableUI' | Remove-AppxPackage

Getting this Error:

Remove-AppxPackage : Deployment failed with HRESULT: 0x80073CFA, Removal failed. Please contact your software vendor. (
Exception from HRESULT: 0x80073CFA)
Package Manager aborted the Remove operation because an invalid argument was passed: Get-AppXPackage -Name Microsoft.Xb
oxGameCallableUI.
NOTE: For additional information, look for [ActivityId] eb445625-b0a9-0002-d590-44eba9b0d301 in the Event Log or use th
e command line Get-AppxLog -ActivityID eb445625-b0a9-0002-d590-44eba9b0d301
At C:\Users\Viktor\Desktop\Remove Windows 10 Apps.ps1:11 char:50
+ $appXPackage + ' Microsoft.XboxGameCallableUI' | Remove-AppxPackage
+                                                  ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (Get-AppXPackage...xGameCallableUI:String) [Remove-AppxPackage], IOException
    + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.RemoveAppxPackageCommand

EDIT: And how can i story applications names inside array and loop through it

1
  • 1
    Why are you attempting to store Get-AppXPackage -Name in a string? Why not just call the cmdlet directly? Commented Feb 28, 2018 at 16:41

3 Answers 3

2

Skip the intermediate step of attempting to store half a statement in a string:

$PackageName = 'Microsoft.XboxGameCallableUI' 
Get-AppxPackage -Name $PackageName | Remove-AppxPackage
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks any way i can store all apps name inside array and loop throughout it?
to simply remove everything that is in Get-AppXPackage try this: Get-AppxPackage | Remove-AppxPackage I would run this first to make sure you truly want to remove all of that Get-AppXPackage | Select Name
@Andrew of course there is, please update your question to show what you're actually trying to do, don't make us guess or write all the code for you.
0

This way you could define the application packages you want to remove.

$applicationPackages = "Application.Name","Application2.Name","Application3.Name"
Foreach($application in $applicationPackages){
    Remove-AppxPackage -Name $application
}

One step further if you know part of the names you could do this to create the array

$applicationPackages = Get-AppxPackage | where-object {$_.Name -match "someapplication*|someotherApplication*"}

Comments

-1

You're trying to create a Windows 10 image. You're running sysprep, and you're bumping into that issue with the default programs? ...Microsoft.

This is what you're asking about.

$list_of_packages = @('Microsoft.XboxGameCallableUI', '...', '...')

foreach ($package_name in $list_of_packages) {
  Remove-AppXPackage -Name $package_name
}

But, let's skip ahead. You'll probably try the following if you haven't already...

Good luck.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.