ErrorVariable is not set when using Get-InstalledModule cmdlet
See original GitHub issuePoweshell 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.
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
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
PowerShellGet has a rather…creative implementation.