You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get error when try to use windowsRelease function.
Environment
npm versions: not important
OS: windows 7
Possible Solution
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.
👍
The text was updated successfully, but these errors were encountered:
Error
Get error when try to use windowsRelease function.
Environment
Possible Solution
Yeah, I solved this issue.
Let me tell you why this happen?
windows-release
have two commands to check OS namewmic 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 inC:\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 andwmic
is not work if user don't add path ofwmic.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.
👍
The text was updated successfully, but these errors were encountered: