Scope
This article applies to any scenario where the Get-WMIObject cmdlet is expected to be available and functioning within a PowerShell Universal instance. Effectively, this article will only apply to instances that run under the Windows operating system.
Problem
Get-WMIObject is not recognized as a cmdlet within any of the PowerShell Universal script editing interface.
(figure shows a Script in PowerShell Universal is not recognizing the Get-WMIObject cmdlet)
Root Cause
PowerShell Universal, by default, uses the integrated PowerShell environment which will be a recent version of PowerShell Core (i.e. it is not Windows PowerShell). The
Get-WMIObject cmdlet was deprecated in favor of
Get-CimInstance in PowerShell Core therefore it only exists in legacy Windows PowerShell.
Solution #1 (Recommended)
Adapt your code to use Get-CimInstance instead of Get-WMIObject.
Solution #2
Change the Environment of the (script, app, endpoint) to use the Windows PowerShell environment instead of the default Integrated environment.
Please read the documentation and be advised around the implications of using Windows PowerShell in your PowerShell Universal workloads[1]
(figure shows the Environment changed to Windows PowerShell on a PowerShell Universal Script)
(figure shows the results of Get-WMIObject when run through a Windows PowerShell environment)
Reference