Skip to content

wmic.exe is being removed from Windows — Windows CPU/memory/disk detection will break #992

Description

@stumbaumr

Microsoft has announced that wmic.exe (the WMIC command-line tool) is being removed from Windows:
https://support.microsoft.com/en-us/servicing/os/windows/docs/2025/09/windows-management-instrumentation-command-line-wmic-removal-from-windows

mysqltuner.pl (current master, v2.9.2) still shells out to wmic in several places for Windows system info:

  • wmic cpu get NumberOfCores (line 2331)
  • wmic cpu get NumberOfLogicalProcessors (line 2369)
  • wmic ComputerSystem get TotalPhysicalMemory (line 2905)
  • wmic OS get FreeVirtualMemory (line 2909)
  • wmic logicaldisk get Name,Size,FreeSpace (line 5189)
  • wmic os get osarchitecture (line 6807)

wmic is also listed as an allowed command in the system-command regex around line 3255.

Once wmic.exe is no longer present (it's already gone on newer Windows builds, and fully removed per the linked schedule), all of these calls will fail, so Windows CPU/memory/disk/architecture detection will silently produce empty/wrong results.

Suggested fix: replace these with PowerShell Get-CimInstance equivalents, e.g.:

Get-CimInstance Win32_ComputerSystem | Select-Object -ExpandProperty TotalPhysicalMemory
Get-CimInstance Win32_OperatingSystem | Select-Object -ExpandProperty FreePhysicalMemory
Get-CimInstance Win32_Processor | Select-Object -ExpandProperty NumberOfCores
Get-CimInstance Win32_Processor | Select-Object -ExpandProperty NumberOfLogicalProcessors
Get-CimInstance Win32_LogicalDisk | Select-Object Name,Size,FreeSpace
Get-CimInstance Win32_OperatingSystem | Select-Object -ExpandProperty OSArchitecture

invoked via powershell -NoProfile -Command "..." from Perl, similar to how wmic is currently invoked with backticks.

Happy to submit a PR if that's useful.

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