Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SamuelBlaettler opened this issue Jun 15, 2023 · 13 comments

Comments

@SamuelBlaettler
Copy link

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
Copy link
Owner

byteben commented Jun 15, 2023

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
Copy link
Author

SamuelBlaettler commented Jun 16, 2023

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
Copy link
Owner

byteben commented Jun 16, 2023

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

@SamuelBlaettler
Copy link
Author

I ran the tests with 1.06.15.0

@byteben
Copy link
Owner

byteben commented Jun 17, 2023

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
Copy link
Owner

byteben commented Jun 18, 2023

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
Copy link
Author

SamuelBlaettler commented Jun 19, 2023

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
Copy link

z22kk commented Jun 19, 2023

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
Copy link
Owner

byteben commented Jun 19, 2023 via email

@z22kk
Copy link

z22kk commented Jun 19, 2023

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
Copy link
Owner

byteben commented Jul 3, 2023

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
Copy link

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
Copy link
Owner

byteben commented Aug 4, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants