question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ErrorVariable is not set when using Get-InstalledModule cmdlet

See original GitHub issue

Poweshell Version: 6.1.4

ErrorVariable is not set when an error happens as seen in the screenshot below. However, if you use + append sign in front of the variable, it works.

Steps to reproduce

Below you will see that I try to run the command without the + to set the ErrorVariable, which won’t work. Later, it works with + with a different parameter. In the first case, outputting the $errorVariable does not display anything.

image

Expected behavior

ErrorVariable should be working without the need of + append operator in front.

Actual behavior

ErrorVariable is not set when an error happens.

Environment data

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
vexx32commented, Aug 22, 2019

I guess that makes this a PowerShellGet issue?

Genuinely not sure how you’d author a cmdlet that breaks this behaviour, though. I didn’t think it could be done.

@SteveL-MSFT are you familiar with this cmdlet at all? Might be worth a look as you guys get towards PSGet 3.0, if this cmdlet is being retained going forward.

1reaction
KirkMunrocommented, Aug 22, 2019

PowerShellGet has a rather…creative implementation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I check if a PowerShell module is installed?
You can use the ListAvailable option of Get-Module : ... If (-not(Get-InstalledModule SomeModule -ErrorAction silentlycontinue)) ...
Read more >
Troubleshoot common errors in Microsoft Graph PowerShell
If your installed module isn't up to date, update it by running: ... use Find-MgGraphCommand cmdlet or the API permissions reference.
Read more >
Get-InstalledModule (PowerShellGet) - PowerShell
The Get-InstalledModule cmdlet gets PowerShell modules that are installed on a computer using PowerShellGet. To see all modules installed on the system, ...
Read more >
Try/Catch failing for Import-Module : r/PowerShell
When I run this, expecting it to fail, I'm not getting the output from the Catch block. I tried adding -ErrorAction SilentlyContinue, ...
Read more >
Updating your PowerShell modules to the latest version ...
When running the script with no parameter, it will update all modules to the ... $CurrentModules = Get-InstalledModule | Select-Object Name, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found