microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.35k stars 1.45k forks source link

Repair-WinGetPackageManager does not detect provisioned but not registered state #4603

Open JohnMcPMS opened 4 months ago

JohnMcPMS commented 4 months ago

Brief description of your issue

Repair-WinGetPackageManager does not detect the state where the package has been provisioned for the machine but not registered for the user. This may lead to a failure if the provisioning step does an async registration that does not complete before we attempt to check for the registration side effects.

Detecting this state is complicated by the fact that there is no obvious way to use the PS commands to find a staged package without elevation. If we are running elevated, we can add -AllUsers to the existing check as a fix. If not, we either need to request changes to Get-AppxPackage or find another mechanism.

Steps to reproduce

Provision the package, then remove it for the user. Note that the repair state machine will detect this as "not installed" rather than "not registered".

Expected behavior

The repair state machine registers the package.

Actual behavior

The repair state machine determines "not installed", leading to unnecessary downloads or an error if the provisioning of the previous state didn't register for the user in time.

Environment

Latest PS module: 1.8.1791
github-actions[bot] commented 4 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.