Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System Information not working for method calls that include powershell commands execution on a machine that has powershell disabled. #654

Open
paragdulam opened this issue Feb 17, 2022 · 4 comments

Comments

@paragdulam
Copy link

paragdulam commented Feb 17, 2022

Describe the bug
If powershell is disabled by a system admin in an enterprise environment, the System Information npm is failing to output information about:

osinfo.hardware, or osinfo in general
networkinterfaces() returns error
cpu() returns empty errored data
diskLayout() returns empty array

To Reproduce
Steps to reproduce the behavior:

  1. Please disable powershell in your windows machine using link
  2. Search for "How to block PowerShell access using Security Policy" in the link mentioned in point 1.
  3. Once disabled, all the methods that use powershell commands stop working

Current Output
Few methods like osinfo, cpu and diskLayout output error or empty data

Expected behavior
I am not sure if systeminformation is supported on powershell disabled windows machines. But It would be great for me I could read systeminformation on powershell disabled windows machines.

Environment (please complete the following information):

  • systeminformation package version: 5.10.5
  • Windows 10 with powershell disabled
@ghost
Copy link

ghost commented Feb 17, 2022

Hello,

I reproduced the issue.
Package version 5.9.9 is the last one to work in this environment, try to use it.
5.9.10+ does not work anymore. getStaticData() promise does not error nor callback correctly, which made errors handling pretty difficult in this case.

image

Kind regards

@sebhildebrandt
Copy link
Owner

@paragdulam, @CapitaineBidouille ... since wmic is unfortunately dropped in the most recent versions of windows, we had to make the transition to powerShell. See also #616 ... So what I do see as possible solutions:

  • first checking the error handling (not having powerShell) on my side to get at least no errors.
  • thinking of having then 2 possible ways of gathering windows system information (wmic as a fallback)

As this would result in a lot of code changes, I am not sure if and when I would be able to do this ...

@paragdulam
Copy link
Author

@sebhildebrandt @CapitaineBidouille

Just putting forth an idea,

may be we can make a node-addon out of this
https://docs.microsoft.com/en-us/windows/win32/sysinfo/system-information

and use that in systeminformation

Problems can be

  • If it is using power shell internally it still won't work on power shell disabled windows machine. I personally think it is using some core internal api and not power shell
  • It would only work for windows.

What do you guys think?

@paragdulam
Copy link
Author

Hello,

I reproduced the issue. Package version 5.9.9 is the last one to work in this environment, try to use it. 5.9.10+ does not work anymore. getStaticData() promise does not error nor callback correctly, which made errors handling pretty difficult in this case.

image

Kind regards

Version 5.9.9 was also using powershell commands in it. I downgraded to v4.30.0. This was using wmic commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants