wmic.exe is being removed from Windows — Windows CPU/memory/disk detection will break
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 9.5k
- Forks
- 1.3k
- Avg merge
- 9h 4m
- Merged PRs (30d)
- 8
Description
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.:
```powershell
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in mysqltuner.pl at the listed WMIC calls around lines 2331, 2369, 2905, 2909, 5189, and 6807, then inspect the allowed-command regex around line 3255. Replace the Windows CPU, memory, disk, and architecture lookups with the suggested PowerShell Get-CimInstance equivalents, and verify that the detection paths still return the expected values without wmic.exe.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl, powershell
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100