What can I do about "WMIC is deprecated"? What can I do about "WMIC is deprecated"? windows windows

What can I do about "WMIC is deprecated"?


As mentioned in comments, WMIC is utility that acts as interface to communication with WMI. It's not WMI itself that is being deprecated, but "just" the interface. Since Microsoft is pushing PowerShell, I believe official successor wmic would be PowerShell commandlet Get-WmiObject. How to use this can be found on Microsoft documentation: LINK

[UPDATED] As correctly pointed out within comment, commandlet Get-WmiObject shall sunset one day and is not encouraged to be used. Only proper method is Get-CimInstance, which has pertty much same syntax as Get-WmiObject. See Microsoft documentation: LINK

For your particular case PowerShell alternative would be following:

wmic memorychip get capacity

Get-CimInstance -ClassName Win32_PhysicalMemory | Select-Object capacity

wmic diskdrive get Status,Model

Get-CimInstance -ClassName Win32_diskdrive | Select-Object status, model

Commands in wmic are usually derived from WMI class names, but it's not really rule of thumb. With PowerShell you are accessing WMI by it's real class name instead, so you may need to seek for other classes if needed

Undisputed advantage to PowerShell over wmic is that output is an object and you can easily continue working with the output, while wmic returns a string only that you eventually need to parse for example if used inside scripts and that brings another benefit of e.g. output formatting - you can easily reformat any output for example to as you mentioned JSON, just pass your command through another pipe into commandlet ConvertTo-Json and you will have your expected output.

Example:

Get-CimInstance -ClassName Win32_diskdrive | select status, model | ConvertTo-JSON

Output:

{    "status":  "OK",    "model":  "SAMSUNG MZNTY256HDHP-000L7"}

Hope this helps


Unless powershell can be used like a dos runtime to complete a command for Java program etc., it does not meet requirements since it's removing tools that other programs depend on with no replacement.