【发布时间】:2019-02-02 16:27:40
【问题描述】:
尝试在 PowerShell(版本 6)中使用 get-WmiObject 命令时出现以下错误:
PS C:\Users\zsofi> Get-WmiObject Win32_product | select name, packagecache
Get-WmiObject : The term 'Get-WmiObject' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-WmiObject Win32_product | select name, packagecache
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-WmiObject:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException`
【问题讨论】:
-
根据 MSDocs 网站
The requested page is not available for PowerShell 6. You have been redirected to the newest product version this page is available for....并且此时“最高版本”是 5.1。据我所知,您应该能够使用Get-CimInstancecmdlet - Get-CimInstance (CimCmdlets) | Microsoft Docs — docs.microsoft.com/en-us/powershell/module/cimcmdlets/…
标签: powershell wmi powershell-core cim