Description
We have the following situation on windows machines, where tickets #520, #600, #610, #611, #613, #646, #650 are related to:
-
wmic
(one of the methods, how this package gained system information) was marked as depricated for some time now. Windows 11 now completely droppedwmic
support. But fortunately there are alternatives. -
due to problems with international character sets we anyway needed to drop
wmic
and move to the corresponding PowerShell commands. I started this transition with verion 5.9.7. -
Since version 5.9.10
wmic
is no longer used and all commands now usePowerShell
.
I used powerShell
in systeminformation since verion 3 but did not see any problems so far. But it seems that there are some drawbacks:
- PowerShell commands are slightly slower. In some cases (e.g
users
, I now need to make three calls instead of one). - it seems, that in some cases PowerShell does not clear up completely after giving back the results to nodeJS. I was not able to reproduce it till now so this is under investigation.
- Spinning up a PowerShell instance from node.js takes quite a few resources (time and CPU)
- You need to have Powershell Version 5+ on your machine to have correct international characters - which should be installed on Windows 10, 11. When you use Window 8.1 or lower there might be an older version of PowerShell installed,
As now all commands are rewritten using PowerShell instead of WMIC I made some improvements to tackle some of the problems above (time and CPU consumption). To only spin up a PowerShell instance once, I have created the possibility to enable the persistent power shell:
- on startup of your code (if you are running in windows):
si.powerShellStart();
- and then again when shutting down the app:
si.powerShellRelease();
This improves speed and CPU consumption drastically and removes the problem of cleaning up after each powerShell call.