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
Skip the intermediate step of attempting to store half a statement in a string:
$PackageName = 'Microsoft.XboxGameCallableUI'
Get-AppxPackage -Name $PackageName | Remove-AppxPackage
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*"}
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.
User contributions licensed under CC BY-SA 3.0