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

Error: spawn wmic ENOENT on Windows 11 24H2 #20

Open
MikeMcC399 opened this issue Nov 30, 2024 · 10 comments
Open

Error: spawn wmic ENOENT on Windows 11 24H2 #20

MikeMcC399 opened this issue Nov 30, 2024 · 10 comments

Comments

@MikeMcC399
Copy link

MikeMcC399 commented Nov 30, 2024

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.11.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
Copy link
Author

@simonepri

Do you intend to continue to maintain this repo?

@simonepri
Copy link
Owner

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

@MikeMcC399
Copy link
Author

@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

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

@simonepri
Copy link
Owner

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?

@MikeMcC399
Copy link
Author

MikeMcC399 commented Dec 9, 2024

@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.

@MikeMcC399
Copy link
Author

@simonepri

@MikeMcC399
Copy link
Author

The issue also affects Windows Server:

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

@MikeMcC399
Copy link
Author

MikeMcC399 commented Dec 19, 2024

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

@MikeMcC399
Copy link
Author

@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 ci: update ci to supported node.js 18 - 23 versions #25 is only a small part and it is currently waiting for approval to run.

@MikeMcC399
Copy link
Author

@simonepri

I haven't had any more feedback from you since your response #20 (comment) 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 <simone.primarosa@gmail.com>

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

No branches or pull requests

2 participants