-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Repair-WingetPackageManager not working as expected in system context #4271
Comments
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:
|
I can reproduce this on several machines that are currently on 1.5 or 1.6 and not updating to 1.7 |
I've also verified the same behaviour on a machine with a very old DesktopAppInstaller that didn't even include winget and it reports that winget is healthy when it's not even present. |
Which version of the Microsoft.WinGet.Client module is being used, and is there any chance older versions of that module are in the module path? |
$env:PSModulePath -split ';' C:\Users\Administrator\Documents\WindowsPowerShell\Modules |
Hi @denelon , Every time I run it on a new machine I am using this to pull the latest: Install-PackageProvider NuGet -Force |
If you run |
PS C:\WINDOWS\system32> Get-Command -Module Microsoft.WinGet.Client CommandType Name Version Source Cmdlet Add-WinGetSource 1.7.10661 Microsoft.Winget.Client |
PS C:\Users\nephraim> winget --info Windows: Windows.Desktop v10.0.19045.4046 Winget DirectoriesLogs %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Diag… LinksPrivacy Statement https://aka.ms/winget-privacy Admin Setting StateLocalManifestFiles Disabled |
PS C:\WINDOWS\system32> Repair-WingetPackageManager -Force -Latest -Verbose |
PS C:\WINDOWS\system32> $env:PSModulePath -split ';' |
OK. I believe I've got a clean repro. |
I'm building a set of WinGet Configurations and PowerShell scripts to demonstrate the various approaches to bootstrapping WinGet and running WinGet in the system context. There are several scenarios that do not work and a few that do. This is due to the differences between packaged and unpackaged applications as well as the differences between WinGet CLI and the PowerShell modules. Differences between Windows PowerShell and PowerShell 7 also affect the outcome. The Repair-WinGetPackageManager was designed to bootstrap the WinGet CLI for a logged-on user (not necessarily the system context). These will all be made available, and they will need a SKU of Windows with the Windows Sandbox enabled. |
My use case is installing / repairing Winget via an Intune script. Currently there isn't a good way to ensure the Desktop App Installer is getting updated properly so I have a wide range of Winget versions in my environment and the main issue I have encountered is the --installer-type option not being supported in old versions, so I am seeing a lot of deployment failures purely because of the Winget version spread on my devices. I have tried a couple of ways to invoke a store apps update but that is also inconsistent. |
The following PowerShell command will "stage" the App Installer when run in the system context (assuming the MSIX packages are available on the system). This also assumes WinGet 1.7 is the desired version with the dependencies on VCLibs and UI.Xaml.
I've been working on a Windows Sandbox configuration to use as an example to show this working under nt authority/system, but in Windows Sandbox the WDAGUtilityAccount is also logged in so the package is actually "registered" for the currently logged in user. |
@PckgrTom if you add "-Force -Latest" it should upgrade to the latest stable version. Without those arguments/parameters, the cmdlet is just making sure the current version installed is in a good state. Can you do this and add the "Get-WinGetVersion" output to the statements afterwards? Which version of the Microsoft.WinGet.Client PowerShell module is present on these systems? |
Brief description of your issue
Running "Repair-WingetPackageManager -Force -Latest" in the system context reports back that Winget is in a good state even though it is not up to date or in some instances, working at all. This is important as Intune and SCCM etc. run scripts in the system context not elevated admin. If I run the same command as admin it repairs / updates Winget as expected.
Steps to reproduce
.\PsExec.exe -i -s powershell
Repair-WingetPackageManager -Force -Latest -Verbose
Expected behavior
Expect Winget to be repaired / updated from v1.6.3133 to latest
Actual behavior
VERBOSE: Creating MTA thread
VERBOSE: WinGet is in a good state.
Environment
The text was updated successfully, but these errors were encountered: