Has WMIC been un-deprecated?

For a long time, I've been putting off changing all my WMIC-based commands into "whatever modern junk Microsoft wants me to use now", having spent significant time trying (and failing) to find alternatives.

To stress me further, it kept showing "WMIC has been deprecated." with red, scary letters each time the command was run.

Now, I again revisited this problem and tried typing in:

WMIC os get InstallDate

... and the red warning text is gone. There is no mention that WMIC is being deprecated or has been deprecated. Does this mean what I hope it does? Namely, that Windows will keep supporting it indefinitely or for a very long time?

I sure hope so, because I just don't have the energy left for anything changing ever again now.


Solution 1:

To stress me further, it kept showing "WMIC has been deprecated." with red, scary letters each time the command was run.

WMIC has indeed already been deprecated.

The WMI command-line tool (Wmic) is deprecated. Use PowerShell cmdlets instead.

Additionally, the Get-WmiObject documentation indicates this happened a while ago with PowerShell 3.0, which was release 13 years ago. PowerShell 3.0 was released with Windows Server 2012 and Windows 8.0.

Starting in PowerShell 3.0, this cmdlet has been superseded by Get-CimInstance.

Source:

  • Windows Server 2012/Windows Server 2012 R2 and Windows 8.0/Windows 8.1

Since you indicated you are not currently getting this warning, I will assume you have a different environment than the environment that displayed the warning message. I will also assume that you had PowerShell Core installed at one point and were running WMIC commands within a PowerShell 6.0+ prompt. I am also going to assume that the difference in environments is that you are now using a system that only has PowerShell 5.1 installed. I have no reason to believe these assumptions are incorrect.

The most logical reason you were being notified that WMIC was deprecated is due to PowerShell Core being installed, Get-WmiObject appears to be discontinued in favor of Get-CimInstance in PowerShell Core 6.0 and newer. My research indicated that Get-WmiObject was actually removed in PowerShell Core 6. It's important to highlight that while you normally would run a WMIC command within a Command Prompt instance, I was able to successfully run it within a PowerShell 5.1 instance.

There is no mention that WMIC is being deprecated or has been deprecated. Does this mean what I hope it does?

It has already been replaced. So instead, you should be using Get-CimInstance, which is supported by both PowerShell 5.1 and PowerShell (Core) 6.0 and newer. PowerShell (Core) is intended to be the next version of PowerShell, and it is the only version of PowerShell that Microsoft is developing. The legacy PowerShell 5.1 branch was discontinued back in 2014.

My assumption that you were running WMIC commands in a PowerShell 6 or newer prompt is supported by the following statement regarding a Microsoft Documentation GitHub bug report on the subject.

The cmdlets with WMI in the name were removed from PowerShell 6 and are no longer supported. The WMI functionality is provided by the CIMCmdlets module.

The individual who indicates WMI cmdlets were removed in PowerShell 6 is a Senior PowerShell developer at Microsoft.

Source:

  • Samples in this documentation do not work by default either on Windows 7 or Windows 10 #5156

  • Collecting Information About Computers

Namely, that Windows will keep supporting it indefinitely or for a very long time?

Microsoft has not explicitly announced when WMIC itself will no longer be supported. Microsoft has also not asserted that PowerShell 5.1 will not be installed in a future version of Windows. As long as PowerShell 5.1 is installed on Windows 10 or Windows Server, WmiObeject and WMIC will continue to be supported. Microsoft has also not announced when we should expect the legacy Command Prompt to no longer be available on Windows.

Based on all the facts, you should update your scripts since you are using something that was discontinued back in 2014, but you likely have several years to accomplish that goal.

Background:

  • What can I do about “WMIC is deprecated”?