Closed RygelXVI closed 1 month ago
What version of PowerShell are you using?
I'm using PowerShell 7.3.8, behaviour is also the same on 7.3.7
Ran into a similar issue. Got the same "Failed to create instance: -2147483633" error with v0.2.2 but only when running Find-WingetPackage command in a script that was launched from an Scheduled Task with the Run whether user is logged on or not box checked on a Windows 10 workstation! Very unique! It worked properly in interactive sessions and in Windows 11. Downgrading the module to v0.2.1 didn't change anything, but then downgrading to v0.2.0 seems to have fixed the issue at first but it happened later on when I tried it again!
This looks like a problem with the MSIX-installed (user-scoped) version of PowerShell. Running it through the MSI-installed (machine-scoped) powershell works for me
https://github.com/microsoft/winget-cli/assets/88161975/12b77b8a-f3aa-4ff9-b342-84cf495e6bc1
cc @denelon
Note: If you want the MSI installer of PowerShell, you can get it using
winget download Microsoft.PowerShell --installer-type wix
on this (work) computer, PowerShell was installed from the Microsoft Store.
I don't see this problem on my personal computer, where PowerShell was installed with WinGet.
Can anyone clarify why there are issues between how PowerShell is installed? This seems very strange to me. Also why does using the -Verbose
and -Debug
switches not return any further information?
I just uninstalled PS7 MSIX and manually downloaded and installed the MSI package. Still getting the same error when run the script from an Scheduled Task. Works fine in the console! Very odd!
Seem related to #3826
In PowerToys, we're using https://www.powershellgallery.com/packages/Microsoft.WinGet.Client/1.6.3133.0 as a dependency on a new utility: Command Not Found. Unfortunately the plugin doesn't work on PowerShell when installed from the Microsoft Store or from .msix.
In PowerToys, we're using https://www.powershellgallery.com/packages/Microsoft.WinGet.Client/1.6.3133.0 as a dependency on a new utility: Command Not Found. Unfortunately the plugin doesn't work on PowerShell when installed from the Microsoft Store or from .msix.
Is there a third installation method that IS supported, then? I'm on Win11 and I'm trying to get it to work but I don't know how to update the bundled Powershell to version 7.**, just install the newer version as an MSIX
Damn, MSIX is still a second-class citizen, even today? :(
It seems like the MSIX version now works?
Can anyone confirm this has been fixed in the latest version of Microsoft.WinGet.Client? I believe this issue has been resolved.
Hi @denelon , I can confirm the issue has been fixed for the use case in PowerToys when installing from the Microsoft Store. Thank you!
Works for me too. Thanks!
Should we closed this? Seems like it's fixed.
Brief description of your issue
attempting to use any winget powershell commands will fail with "Get-WinGetPackage: Failed to create instance: -2147483633" using
Get-WinGetPackage -Verbose -Debug
does not produce further information. usingtry { get-wingetpackage } catch { $_.exception }
captures the following stacktrace:Steps to reproduce
use a winget powershell command, e.g.
get-wingetpackage | where { $_.Isupdateavailable }
Expected behavior
a list of packages with updates available to be displayed in the shell (in fact the same list of packages that would be displayed using
winget upgrade
Actual behavior
error message "Get-WinGetPackage: Failed to create instance: -2147483633" is returned
Environment