なぜ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$
ベストアンサー1
というクロスプラットフォームモジュールがあり、DnsClient-PS
このモジュールのコマンド名はですResolve-Dns
。これらの機能は以下と若干異なりますResolve-DnsName
。
> Find-Module -Name PowerShellGet | Install-Module
> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2
> Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Trusted https://www.powershellgallery.com/api/v2
> Install-Module -Name DnsClient-PS
> Resolve-Dns google.com | Select-Object -Expand Answers
DomainName TimeToLive RecordClass RecordType RecordData
---------- ---------- ----------- ---------- ----------
google.com. 401 IN A 64.233.185.102
google.com. 401 IN A 64.233.185.139
google.com. 401 IN A 64.233.185.138
google.com. 401 IN A 64.233.185.113
google.com. 401 IN A 64.233.185.101
google.com. 401 IN A 64.233.185.100