pidtree icon indicating copy to clipboard operation
pidtree copied to clipboard

Error: spawn wmic ENOENT on Windows 11 >=24H2

Open MikeMcC399 opened this issue 1 year ago • 10 comments

  • This issue follows on from https://github.com/simonepri/pidtree/issues/18 which was not followed through or resolved.

pidtree has a dependency on the deprecated Windows Management Instrumentation command-line (WMIC) utility

Issue

pidtree depends on wmic which is removed by default in new installations of Windows 11 24H2.

For Microsoft Windows Servers, wmic has been deprecated since 2016 and it is not installed by default on Windows Server 2025 (see Features we're no longer developing).

Steps to reproduce

Microsoft Windows 11 24H2, Node.js v22.14.0 LTS

If this is an upgrade from a earlier Windows 11 version, then WMIC can be removed manually to simulate a new installation of Windows 11 24H2. In a Windows Admin Terminal, execute:

DISM /Online /Remove-Capability /CapabilityName:WMIC~~~~

then execute the following:

npm install pidtree -g
pidtree

Logs

$ pidtree
Error: spawn wmic ENOENT

Suggestion

Implement an alternative to WMIC as advised by the Microsoft IT PRO Blog post WMI command line (WMIC) utility deprecation: Next steps

Workaround

In a Windows Admin Terminal, execute the following to check if WMIC is installed:

DISM /Online /Get-CapabilityInfo /CapabilityName:WMIC~~~~

and if necessary, then install WMIC

DISM /Online /Add-Capability /CapabilityName:WMIC~~~~

References

MikeMcC399 avatar Nov 30 '24 16:11 MikeMcC399

@simonepri

Do you intend to continue to maintain this repo?

MikeMcC399 avatar Dec 09 '24 12:12 MikeMcC399

Yes and no, in the sense that I don't actively work on this but if something is broken and people contribute I'm happy to help

simonepri avatar Dec 09 '24 14:12 simonepri

@simonepri

Thank you very much for responding and explaining your position!

At this time I'm unsure how visible the reliance on the deprecated Windows WMIC feature is going to be. I ran npm test from the npm module npm-run-all2 (which has "pidtree": "^0.6.0" in its dependencies) on Windows 11 24H2 after removing the WMIC capability, and there were no errors reported.

Only new installations of Windows 11 24H2 have the WMIC capability disabled. Upgrading from an earlier Windows 11 release does not remove the capability.

For Windows Server 2025 it is listed under Features we're no longer developing

Beginning with Windows Server 2025, WMIC is available as a feature on demand (FoD) which can be added with the DISM /Add-Capability command. It will be removed from Windows in a future release. PowerShell for WMI replaces the WMIC tool. Use PowerShell or programmatically query WMI as a replacement for WMIC. To learn more about WMIC depreciation, see WMI command line (WMIC) utility deprecation: Next steps

  • GitHub Actions plans for https://github.com/actions/runner-images/issues/10806 , however it remains to be seen if they enable the WMIC capability by default or not.

pidtree can't be considered "broken". It just relies on a deprecated feature, and there is a workaround available.

MikeMcC399 avatar Dec 09 '24 14:12 MikeMcC399

I think that if there's an alternative we can use, pidtree should try to fallback to that if possible without the user having to do anything. Would you be interested in helping implement it?

simonepri avatar Dec 09 '24 15:12 simonepri

@simonepri

I think that if there's an alternative we can use, pidtree should try to fallback to that if possible without the user having to do anything. Would you be interested in helping implement it?

I can offer some support. I noticed that there are some CI compatibility issues, which will get in the way if they are not addressed.

  • ~~PR https://github.com/simonepri/pidtree/pull/21 addresses one step in linting, for your consideration and review~~
  • ~~PR https://github.com/simonepri/pidtree/pull/12 which is now 3 years old, would need revisiting, as Node.js 18 is now the lowest supported version in general, not Node.js 14.~~

MikeMcC399 avatar Dec 09 '24 17:12 MikeMcC399

@simonepri

  • I've submitted PR https://github.com/simonepri/pidtree/pull/25 to clear the way for making more updates. Please take a look and approve running the workflows, so that they can run to prove they are successful.

MikeMcC399 avatar Dec 12 '24 11:12 MikeMcC399

The issue also affects Windows Server:

Features removed or no longer developed starting with Windows Server 2025 includes the section

MikeMcC399 avatar Dec 12 '24 14:12 MikeMcC399

Testing on the new GitHub runner confirms that pidtree fails on Windows Server 2025. I will submit a separate issue for this with repro steps.

See Windows Server 2025 is now in public preview

  • Edit: #26 submitted

MikeMcC399 avatar Dec 19 '24 18:12 MikeMcC399

@simonepri

  • Just for clarification: I don't expect to be able to submit a PR to solve this issue. Unfortunately this is outside my skills set.

  • After looking into the repo more deeply, I also saw that there would be quite a lot of work to bring the CI testing up to current versions of dependencies e.g. axe and xo. Regrettably, I don't have enough experience to do this work either. PR https://github.com/simonepri/pidtree/pull/25 is only a small part and it is currently waiting for approval to run.

MikeMcC399 avatar Dec 20 '24 11:12 MikeMcC399

@simonepri

I haven't had any more feedback from you since your response https://github.com/simonepri/pidtree/issues/20#issuecomment-2528384220 last month, so I am now wondering if you are still willing and able to support changes in this repo.

Could you please update on your plans? According to npm you are the only one able to publish updates to the npm package pidtree:

$ npm owner ls pidtree
simonepri <[email protected]>
  • ~~PR #25 is still waiting for review. Please either accept this PR or reject it.~~ Edit: now closed due to lack of response.

MikeMcC399 avatar Jan 02 '25 10:01 MikeMcC399