pidtree
pidtree copied to clipboard
Error: spawn wmic ENOENT on Windows 11 24H2
- 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
-
Features Removed or Deprecated in Windows Server 2012 Aug 30, 2016
The WMI command-line tool (Wmic) is deprecated. Use PowerShell cmdlets instead.
-
Deprecated features for Windows client Nov 14, 2024
Windows Management Instrumentation command-line (WMIC) utility.
The WMIC utility is deprecated in Windows 10, version 21H1 and the 21H1 General Availability Channel release of Windows Server. This utility is superseded by Windows PowerShell for WMI. Note: This deprecation applies to only the command-line management utility. WMI itself isn't affected.
[Update - January 2024]: Currently, WMIC is a Feature on Demand (FoD) that's preinstalled by default in Windows 11, versions 23H2 and 22H2. In the next release of Windows, the WMIC FoD will be disabled by default.