Skip to content

[Bug]: When winget.exe fails to export package list to file, Get-WGInstalled returns an unrelated error message #16

@bsudano

Description

@bsudano

Describe the problem

Running Get-WGInstalled -Verbose returns the following output:

VERBOSE: [14:14:23.7692236 BEGIN  ] Starting Get-WGInstalled
VERBOSE: [14:14:23.7695455] Starting Get-WGPath
VERBOSE: [14:14:23.7996964] Running as domain\ben
VERBOSE: [14:14:23.7999407] Using user default location
VERBOSE: [14:14:23.8001315] Ending Get-WGPath
VERBOSE: [14:14:23.8003343 PROCESS] Building list of packages with a winget source
WARNING: There was a problem getting a list of installed packages.
Get-Job: C:\Users\ben\Documents\PowerShell\Modules\WingetTools\1.6.0\functions\Get-WGInstalled.ps1:122
Line |
 122 |          if (Get-Job -Name wg) {
     |              ~~~~~~~~~~~~~~~~
     | The command cannot find the job because the job name wg was not found. Verify the value of the Name parameter, and then try the command again.

VERBOSE: [14:14:33.4908814 END    ] Ending Get-WGInstalled

Running & $winget export -s winget -o $tmpFile --include-versions directly produces the following error from winget.exe at the end of the output:

...
An unexpected error occurred while executing the command: 
Download request status is not success.
0x80190194 : Not found (404).

Expectation

Expectation was that if there were an internal winget.exe error, PowerShell's error stream would reflect that

Additional Information

I suppressed the Get-Job error by modifying line 122 in this way:

        if ('wg' -in (Get-Job).Name) {

But I am unsure of the best way to write useful error information from Winget to the PS error stream.

PowerShell version

7.2

Platform

Windows 10 Pro or Enterprise

Additional Checks

  • You are using the latest version of this module.
  • You have read this repository's README file.
  • You have read full help and examples for the command you are having problems with.
  • You are running PowerShell in an elevated session.
  • You are running in a traditional PowerShell console or Windows Terminal

Metadata

Metadata

Labels

bugSomething isn't workingtriagenew issue that needs review

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions