Page 1 of 1

package remove-windows-appx

Published: Dec 11, 2020 - 11:56 AM
by gaelds
Good morning,
I'm getting errors installing the remove-windows-appx package on a small part of my network. Is there a PowerShell equivalent to "run_notfatal"?

Example :
If needed, removing: Microsoft.BingSports
If needed, removing: Microsoft.BingWeather
Traceback (most recent call last):
File "C:\wapt\common.py", line 3876, in install_wapt
exitstatus = setup.install()
File "c:\windows\temp\waptyl5ecp\setup.py", line 93, in install
File "C:\wapt\setuphelpers_windows.py", line 840, in run_powershell
raise CalledProcessErrorOutput(e.returncode,cmd,e.output)
CalledProcessErrorOutput: Command u'$ProgressPreference = "SilentlyContinue"\n(Get-AppXProvisionedPackage -Online | where DisplayName -EQ "Microsoft.BingWeather" | Remove-AppxProvisionedPackage -Online) | ConvertTo-Json' returned non-zero exit status 1.
Output:#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"> S="Error">Remove-AppxProvisionedPackage: The path sp\xe9cifi\xe9 was not found._x000D__x000A_
CalledProcessErrorOutput: Command u'$ProgressPreference = "SilentlyContinue"\n(Get-AppXProvisionedPackage -Online | where DisplayName -EQ "Microsoft.BingWeather" | Remove-AppxProvisionedPackage-Online) | 'ConvertTo-Json' returned non-zero exit status 1.
Output:#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"> S="Error">Remove-AppxProvisionedPackage: The path specified could not be found._x000D__x000A_

Re: Package remove-windows-appx

Published: Dec 11, 2020 - 1:58 PM
by florentR2
I haven't tried it, but I would have tried this:

Code: Select all

MyCommand > $null
Or

Code: Select all

MyCommand > c:\quelquepart.log

Or

Code: Select all

Mycommand | out-null

Re: Package remove-windows-appx

Published: Dec 11, 2020 - 4:08 PM
by gaelds
I still have some positions where it doesn't work:
For example:
Removing undesired Windows Store applications...
If needed, removing: Microsoft.3DBuilder
If needed, removing: Microsoft.Print3D
If needed, removing: Microsoft.Microsoft3DViewer
If needed, removing: Microsoft.MixedReality.Portal
If needed, removing: Microsoft.YourPhone
If needed, removing: Microsoft.WindowsFeedbackHub
If needed, removing: Microsoft.Windows.Cortana
If needed, removing: Microsoft.GetHelp
If needed, removing: Microsoft.BingFinance
If needed, removing: Microsoft.BingNews
If needed,
If needed, removing: Microsoft.BingWeather
Traceback (most recent call last):
File "C:\wapt\common.py", line 3876, in install_wapt
exitstatus = setup.install()
File "c:\windows\temp\wapth6yiqi\setup.py", line 93, in install
File "C:\wapt\setuphelpers_windows.py", line 840, in run_powershell
raise CalledProcessErrorOutput(e.returncode,cmd,e.output)
CalledProcessErrorOutput: Command u'$ProgressPreference = "SilentlyContinue"\n(Get-AppXProvisionedPackage -Online | where DisplayName -EQ "Microsoft.BingWeather" | Remove-AppxProvisionedPackage -Online | out-null) | ConvertTo-Json' returned non-zero exit status 1.
Output:#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"> S="Error">Remove-AppxProvisionedPackage: The path sp\xe9cifi\xe9 was not found._x000D__x000A_
CalledProcessErrorOutput: Command u'$ProgressPreference = "SilentlyContinue"\n(Get-AppXProvisionedPackage -Online | where DisplayName -EQ "Microsoft.BingWeather" | Remove-AppxProvisionedPackage-Online | out-null) | 'ConvertTo-Json' returned non-zero exit status 1.
Output:#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"> S="Error">Remove-AppxProvisionedPackage: The path specified could not be found._x000D__x000A_
With this code:

Code: Select all

def install():
    print("Removing undesired Windows Store applications...")
    for app in apps:
        print("If needed, removing: %s" % app)
        #print('Get-AppxPackage -Name "%s" -AllUsers | Remove-AppxPackage' % app)
        run_powershell('Get-AppxPackage -Name "%s" -AllUsers | Remove-AppxPackage | out-null' % app)
        #print('Get-AppXProvisionedPackage -Online | where DisplayName -EQ "%s" | Remove-AppxProvisionedPackage -Online' % app)
        run_powershell('Get-AppXProvisionedPackage -Online | where DisplayName -EQ "%s" | Remove-AppxProvisionedPackage -Online | out-null' % app)


def session_setup():
    print("Removing undesired Windows Store applications...")
    for app in apps:
        print("If needed, removing: %s" % app)
        #print('Get-AppxPackage -Name "%s" | Remove-AppxPackage' % app)
        run_powershell('Get-AppxPackage -Name "%s" | Remove-AppxPackage | out-null' % app)

Re: Package remove-windows-appx

Published: Dec 11, 2020 - 5:06 PM
by florentR2
Yes

Re: Package remove-windows-appx

Published: Dec 12, 2020 - 5:04 PM
by gaelds
Sorry, but none of the solutions work.

Using run_notfatal eliminates the error, but it seems to install too quickly to actually work...

Code: Select all

def install():
    print("Removing undesired Windows Store applications...")
    for app in apps:
        print("If needed, removing: %s" % app)
        run_notfatal('powershell.exe Get-AppxPackage -Name "%s" -AllUsers | Remove-AppxPackage' % app)
        run_notfatal('powershell.exe Get-AppXProvisionedPackage -Online | where DisplayName -EQ "%s" | Remove-AppxProvisionedPackage -Online' % app)