Skip to content

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

@MikeMcC399

Description

@MikeMcC399

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions