Get error when try to use windowsRelease function.
Yeah, I solved this issue.
Let me tell you why this happen?
windows-release
have two commands to check OS name
wmic os get Caption
Get-CimInstance -ClassName Win32_OperatingSystem
When this module try to find os name, it generate error. Because wmic.exe file's path not added in Environment variables and Get-CimInstance is may be old.
Solution
I found Get-CimInstance
command may be old (not sure) so we don't need to anything with it.
But wmic
is a executable file in C:\Windows\System32\wbem
. If we add this file's path in our environment variable, then error will resolve, too simple. But this is use side solution, so it's not good because users may be don't know that their's error produced by this module, then they can't get right solution.
So what can we do?
I got this issue yesterday in mongoDB compass, i try to found solution on internet but i can't find anything. So I try myself, follow codebase and finally found that error is generated by this module.
So I found that Get-CimInstance
is may be old and and wmic
is not work if user don't add path of wmic.exe
in environment variables. But I found new command 'Get-WmiObject' and it is work in all windows OS (not sure). So we can add one more option in function to check OS name. Just we need to replace "Get-CimInstance" with "Get-WmiObject" and it will work.
I hope problem will resolve.
π
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too