pidtree icon indicating copy to clipboard operation
pidtree copied to clipboard

Error: spawn wmic ENOENT on Windows 11 24H2

Open MikeMcC399 opened this issue 11 months 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