Powershell Core 无法执行 Powershell 可以执行的 Cmdlet

Powershell Core 无法执行 Powershell 可以执行的 Cmdlet

当我尝试在 Powershell Core(版本 7.3.5)中执行时,Resolve-DnsName google.de出现错误

Resolve-DnsName: The 'Resolve-DnsName' command was found in the module 'DnsClient', but the module could not be loaded due to the following error: [Cannot process Cmdlet Definition XML for the following file: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\DnsClient\MSFT_DnsClient.cdxml. Cannot convert the "Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter, Microsoft.PowerShell.Commands.Management, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" value of type "System.String" to type "System.Type".]
For more information, run 'Import-Module DnsClient'.

当我运行时,Import-Module DnsClient我得到的大多是相同的错误

Import-Module: Cannot process Cmdlet Definition XML for the following file: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\DnsClient\MSFT_DnsClient.cdxml. Cannot convert the "Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter, Microsoft.PowerShell.Commands.Management, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" value of type "System.String" to type "System.Type".

但是,当我在 Windwows Powershell(版本 5.1.22621.1778)中运行相同的命令时,没有出现任何错误,而是得到了正确的输出。

为什么会出现这种行为差异?我该如何解决?

相关内容