jdhitsolutions / WingetTools

A set of PowerShell tools for working with the winget package manager.
MIT License
146 stars 14 forks source link

[Bug]: Error when running some commands: Get-Job : The command cannot find the job because the job name wg was not found #22

Open thx1200 opened 1 year ago

thx1200 commented 1 year ago

Describe the problem

When running Get-WGInstalled and Get-WGUpgrade, I get the below error. Running the same commands using "winget" does work.

WARNING: There was a problem getting a list of installed packages.
Get-Job : 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.
At C:\Program Files\WindowsPowerShell\Modules\WingetTools\1.7.0\functions\Get-WGInstalled.ps1:122 char:13
+         if (Get-Job -Name wg) {
+             ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (wg:String) [Get-Job], PSArgumentException
    + FullyQualifiedErrorId : JobWithSpecifiedNameNotFound,Microsoft.PowerShell.Commands.GetJobCommand

Expectation

List of packages or starting the upgrade.

Additional Information

Test-WGVersion Installed : 1.4.10173 Online : 1.4.10173 Update : False

PowerShell version

5.1

Platform

Windows 10 Pro or Enterprise

Additional Checks

jdhitsolutions commented 1 year ago

This doesn't surprise me. I have been deferring work on this module. The Winget team is working on a new PowerShell module, https://github.com/microsoft/winget-cli/releases/tag/v1.5.441-preview. I am hoping they will eventually release something that makes this module obsolete. Parsing text and YAML is a poor way to use PowerShell, but it was the only way to manage winget.

thx1200 commented 1 year ago

I tried the official PS Module but it requires PS7 and I was hoping to find something that works with PS5 just so I don't have another dependency and installation I have to push before being able to automate winget via PS. My end goal is I'm just trying to simplify installation and update of a bunch of third party apps across a large number of computers with only Microsoft tooling, but the deeper I dig, the more I realize winget is just not ready for primetime yet. :-)

I never understood why they chose to make it a appx bundle to begin with, those have so many unnecessary complications and aren't supported (easily) on Server, and just seems like an odd decision for what should be a relatively simple command line tool. That's not even getting into why a package manager on Windows isn't "powershell first" from the start but I digress, these have been discussions and criticisms since the beginning of winget. lol.

Thanks for the help!

jdhitsolutions commented 1 year ago

You bring up valid points that have been discussed for years since winget first came out. I'm hoping their PowerShell module can eventually be made available downlevel. I'm also pushing them to add a format output so I can get JSON results. If I can get JSON, that will solve so many of the challenges with my module.