byteben / MEM

40 stars 8 forks source link

Winget installation fails with "server error" in Reset-CompanyPortalInstallation.ps1 #1

Open SamuelBlaettler opened 1 year ago

SamuelBlaettler commented 1 year ago

Verifying/Requesting package acquisition... Verifying/Requesting package acquisition failed: server error Checking if 'Company Portal' is installed using Get-AppXPackage... Get-AppXPackage -AllUsers | Where-Object { $_.Name -like Microsoft.CompanyPortal } -ErrorAction Stop Error: The 'Company Portal' app, with Id '9WZDNCRFJ3PZ', did not install succesfully. Check the Winget logs at 'C:\Windows\Temp\WinGet\defaultState' for more information Finished processing the script

WinGet-2023-06-15-14-07-08.705.log

byteben commented 1 year ago

Thanks for the heads-up.

This looks like a WinGet specific issue

image

Im curious what you see if you enable verbose logging and run the command manually as SYSTEM using psexec

.\winget.exe install --id 9WZDNCRFJ3PZ --accept-package-agreements --accept-source-agreements --source msstore --scope machine --verbose-logs

SamuelBlaettler commented 1 year ago

I'm in the Home Office today and have no access to the device I extracted the original logs, but my second test device (fresh installed W11 22H2) shows the same behavior. As requested, I attach the Winget log with verbose output from this device WinGet-2023-06-16-13-32-56.345.log

On one of my other devices I had still Winget version 1.2.0 installed (did not yet find out why) On this device, the script ran without issues uninstalling Company Portal and logged success reinstalling it. But... Company Portal was not there! After upgrading Winget to version 1.4.1107 I got the same Server error as in the log.

So maybe it would make sense to check the version of Winget at the start of the script....

byteben commented 1 year ago

Did you try the latest script version yet out of interest?

SamuelBlaettler commented 1 year ago

I ran the tests with 1.06.15.0

byteben commented 1 year ago

I'm in the Home Office today and have no access to the device I extracted the original logs, but my second test device (fresh installed W11 22H2) shows the same behavior. As requested, I attach the Winget log with verbose output from this device WinGet-2023-06-16-13-32-56.345.log

On one of my other devices I had still Winget version 1.2.0 installed (did not yet find out why) On this device, the script ran without issues uninstalling Company Portal and logged success reinstalling it. But... Company Portal was not there! After upgrading Winget to version 1.4.1107 I got the same Server error as in the log.

So maybe it would make sense to check the version of Winget at the start of the script....

We check for the latest WinGet package in 1.06.15.0

[string]$winGetPath = ((Get-AppxPackage -AllUsers | Where-Object { $_.Name -eq 'Microsoft.DesktopAppInstaller' }).InstallLocation | Sort-Object -Descending | Select-Object -First 1)

byteben commented 1 year ago

1.06.18.0 - Bug Fixes and New Function

-   New function "Test-WinGet" added to test if WinGet is installed and working. AppXPackages will not be removed if there is an issue with the WinGet command line
    -   Tests WinGet package is installed
    -   Tests WinGet.exe is working
    -   Tests if WinGet command line failure occurs because Visual C++ 14.x Redistributable is not installed
-   Fixed evaluation AppXProvisionedPackage results
-   Minor log and output bugs fixed
SamuelBlaettler commented 1 year ago

Reset-Appx.log I get an error executing winget.exe list with 1.06.18.0 $winGetPath should either get passed to the function or declared as Global I suppose?

z22kk commented 1 year ago

image

heres the log file regarding the server error running the command:

$winGetPath = (Get-AppxPackage -AllUsers | Where-Object { $_.Name -eq 'Microsoft.DesktopAppInstaller' }).InstallLocation | Sort-Object -Descending | Select-Object -First 1
Set-Location $winGetPath
.\winget.exe install --id '9WZDNCRFJ3PZ' --accept-package-agreements --accept-source-agreements --source msstore --scope machine --verbose-logs

WinGet-2023-06-19-22-39-49.326.log

hope this helps. thanks in advance!

byteben commented 1 year ago

Hmm. This is a very specific WinGet error that has been reported to Microsoft several times. What percentage of devices are getting this error?

Get entitlement succeeded. Server error. ProductId: 9WZDNCRFJ3PZ 2023-06-19 22:39:50.088 [CLI ] Terminating context: 0x8a15001e at D:\a_work\1\s\external\pkg\src\AppInstallerCLICore\Workflows\MSStoreInstallerHandler.cpp:8c

Ben Whitmore Enterprise Mobility MVP


From: z22kk @.> Sent: Monday, June 19, 2023 9:40:31 PM To: byteben/MEM @.> Cc: Ben Whitmore @.>; Comment @.> Subject: Re: [byteben/MEM] Winget installation fails with "server error" in Reset-CompanyPortalInstallation.ps1 (Issue #1)

[image]https://user-images.githubusercontent.com/137114591/246930578-a845d7fb-6f79-4d2b-964f-84c8fb4c3edf.png

heres the log file regarding the server error running the command:

$winGetPath = (Get-AppxPackage -AllUsers | Where-Object { $_.Name -eq 'Microsoft.DesktopAppInstaller' }).InstallLocation | Sort-Object -Descending | Select-Object -First 1 Set-Location $winGetPath .\winget.exe install --id '9WZDNCRFJ3PZ' --accept-package-agreements --accept-source-agreements --source msstore --scope machine --verbose-logs

WinGet-2023-06-19-22-39-49.326.loghttps://github.com/byteben/MEM/files/11792981/WinGet-2023-06-19-22-39-49.326.log

hope this helps. thanks in advance!

— Reply to this email directly, view it on GitHubhttps://github.com/byteben/MEM/issues/1#issuecomment-1597734082, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKSAHIFDRAZBOI3TVG5XMRDXMC2L7ANCNFSM6AAAAAAZHZU3YI. You are receiving this because you commented.Message ID: @.***>

z22kk commented 1 year ago

Hmm. This is a very specific WinGet error that has been reported to Microsoft several times. What percentage of devices are getting this error? Get entitlement succeeded. Server error. ProductId: 9WZDNCRFJ3PZ 2023-06-19 22:39:50.088 [CLI ] Terminating context: 0x8a15001e at D:\a_work\1\s\external\pkg\src\AppInstallerCLICore\Workflows\MSStoreInstallerHandler.cpp:8c Ben Whitmore Enterprise Mobility MVP ____ From: z22kk @.> Sent: Monday, June 19, 2023 9:40:31 PM To: byteben/MEM @.> Cc: Ben Whitmore @.>; Comment @.> Subject: Re: [byteben/MEM] Winget installation fails with "server error" in Reset-CompanyPortalInstallation.ps1 (Issue #1) [image]https://user-images.githubusercontent.com/137114591/246930578-a845d7fb-6f79-4d2b-964f-84c8fb4c3edf.png heres the log file regarding the server error running the command: $winGetPath = (Get-AppxPackage -AllUsers | Where-Object { $_.Name -eq 'Microsoft.DesktopAppInstaller' }).InstallLocation | Sort-Object -Descending | Select-Object -First 1 Set-Location $winGetPath .\winget.exe install --id '9WZDNCRFJ3PZ' --accept-package-agreements --accept-source-agreements --source msstore --scope machine --verbose-logs WinGet-2023-06-19-22-39-49.326.loghttps://github.com/byteben/MEM/files/11792981/WinGet-2023-06-19-22-39-49.326.log hope this helps. thanks in advance! — Reply to this email directly, view it on GitHub<#1 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKSAHIFDRAZBOI3TVG5XMRDXMC2L7ANCNFSM6AAAAAAZHZU3YI. You are receiving this because you commented.Message ID: @.***>

tried it with two devices as I wanted to try it out before pushing it into prod. one device via intune script and one locally with psexec as the system account.

byteben commented 1 year ago

All 3 conditions listed below are fixed in V1.07.03.0 of Reset-Appx.ps1 Bug Fixes, Enhancements and Refactoring 🪲🌟🧑‍💻

Condition 1: When WinGet installs the app as SYSTEM, the AppxPackage can fail to register so the AppxPackage regresses, resulting in the ap not being available for the user.

Condition 2: The AppxPackage was staged as SYSTEM

Condition 3: After the WinGet install, WinGet list did not detect the app

WinGet will retry 10 times (by default) to install the app successfully and ensure the conditions above are not present. There is also a 30 second wait (by default) when testing the AppxPackage after WinGet has installed the app

Please check the script to see if it also fixees the entitlement issue you encountered previously. Thanks

derekb519 commented 1 year ago

Hi there, We're looking to utilize this script as we're encountering detection issues when pushing the 'new' Company Portal. We had a mix of user and system level installs, unfortunately. When using this PS script on a few test devices, we're seeing the following where it appears winget is failing to install. Any suggestions? Testing on Win10 21H2 Ent

The 'Microsoft.DesktopAppInstaller' package was not found   Test-WinGetBinary:570   8/4/2023 8:34:09 AM 8784 (0x2250)
The 'Microsoft.DesktopAppInstaller' package was not found or the WinGet binary was not found at ''. Cannot continue Test-WinGetBinary:597   8/4/2023 8:34:09 AM 8784 (0x2250)
byteben commented 1 year ago

Hi,

This script will test to see if WinGet is installed but it won't actually install or repair WinGet. The error indicates that WinGet needs to be remediated on that device before the script will run successfully.

Regards Ben

Ben Whitmore Enterprise Mobility MVP


From: derekb519 @.> Sent: Friday, August 4, 2023 3:18:37 PM To: byteben/MEM @.> Cc: Ben Whitmore @.>; Comment @.> Subject: Re: [byteben/MEM] Winget installation fails with "server error" in Reset-CompanyPortalInstallation.ps1 (Issue #1)

Hi there, We're looking to utilize this script as we're encountering detection issues when pushing the 'new' Company Portal. We had a mix of user and system level installs, unfortunately. When using this PS script on a few test devices, we're seeing the following where it appears winget is failing to install. Any suggestions? Testing on Win10 21H2 Ent

The 'Microsoft.DesktopAppInstaller' package was not found Test-WinGetBinary:570 8/4/2023 8:34:09 AM 8784 (0x2250) The 'Microsoft.DesktopAppInstaller' package was not found or the WinGet binary was not found at ''. Cannot continue Test-WinGetBinary:597 8/4/2023 8:34:09 AM 8784 (0x2250)

— Reply to this email directly, view it on GitHubhttps://github.com/byteben/MEM/issues/1#issuecomment-1665687260, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKSAHIFP7RD27OHZPUJ2NKLXTUAD3ANCNFSM6AAAAAAZHZU3YI. You are receiving this because you commented.Message ID: @.***>