尝试在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`发布于 2019-02-03 02:44:06
据我所知,唯一的方法是兼容性模块。这是Microsoft开发的一个非常简洁的模块,它通过隐式远程连接到同一台计算机上的Windows Powershell 5.1会话,实际上使Windows PS cmdlet在PS Core中可用。https://github.com/PowerShell/WindowsCompatibility
https://stackoverflow.com/questions/54495023
复制相似问题