Resolve-DnsName:术语“Resolve-DnsName”未被识别为 cmdlet 的名称

Thu*_*fir 7 scripting mono .net shell-script powershell

为什么Resolve-DnsName不被认可PowerShell Core?据我记得它PowerShell本身工作得很好。

这是一个.NET对抗dotnet问题吗?根本dotnet就没有这个功能吗?

thufir@dur:~/powershell/webservicex$ 
thufir@dur:~/powershell/webservicex$ dotnet --version
2.1.4
thufir@dur:~/powershell/webservicex$ 
thufir@dur:~/powershell/webservicex$ ./dns.ps1 
Resolve-DnsName : The term 'Resolve-DnsName' 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 /home/thufir/powershell/webservicex/dns.ps1:3 char:1
+ Resolve-DnsName -Name localhost -Type ANY | Format-Table -AutoSize
+ ~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Resolve-DnsName:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

thufir@dur:~/powershell/webservicex$ 
thufir@dur:~/powershell/webservicex$ cat dns.ps1 
#!/usr/bin/pwsh -Command

Resolve-DnsName -Name localhost -Type ANY | Format-Table -AutoSize

thufir@dur:~/powershell/webservicex$ 
Run Code Online (Sandbox Code Playgroud)

请参阅已关闭的问题和technet

Tim*_*edy 1

PowerShell Core 6.0 文档的新增功能中的“向后兼容性”部分中:

作为 Windows 一部分提供的大多数模块(例如,DnsClient、Hyper-V、NetTCPIP、存储等)以及包括 Azure 和 Office 在内的其他 Microsoft 产品尚未明确移植到 .NET Core。PowerShell 团队正在与这些产品组和团队合作,验证其现有模块并将其移植到 PowerShell Core。对于 .NET Standard 和 CDXML,许多传统的 Windows PowerShell 模块似乎确实可以在 PowerShell Core 中工作,但它们尚未经过正式验证,也未得到正式支持。

虽然 Powershell Core 已正式发布,但它仍然是一项正在进行的工作。