PowerShell 无法识别命令 Resolve-DnsName
PowerShell does not recognize the command Resolve-DnsName
电源错误 shell 脚本,
Import-Module DnsClient
Import-Module : The specified module 'DnsClient' was not loaded because no
valid module file was found in any module directory.
At line:1 char:1
+ Import-Module DnsClient
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (DnsClient:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Resolve-DnsName
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 line:1 char:1
+ Resolve-DnsName
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Resolve-DnsName:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\aquib> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
Resolve-DnsName
是 Windows 8/Windows 2012 及更高版本中添加的命令之一。 根据设计,无论您使用哪个版本的 PowerShell,在此之前的 Windows 版本中均不可用。该命令在 Windows 7 和 Windows 2008 R2 及更早版本上不可用。我读过的大多数消息来源都说,该命令所依赖的底层 WinAPI 函数是在 Windows 8/2012 中添加的。
我建议使用 [System.Net.Dns]::GetHostEntry($HostnameOrIP)
或 one of the other non-obsolete static methods in that class。但是,这仅适用于 A、AAAA 和 PTR 记录,并且在 .Net Framework CLR 中没有用于通用 DNS 请求的 class。您必须自己滚动或使用像 ARSoft.Tools.Net.
这样的第三方库
电源错误 shell 脚本,
Import-Module DnsClient
Import-Module : The specified module 'DnsClient' was not loaded because no valid module file was found in any module directory. At line:1 char:1 + Import-Module DnsClient + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (DnsClient:String) [Import-Module], FileNotFoundException + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Resolve-DnsName
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 line:1 char:1 + Resolve-DnsName + ~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Resolve-DnsName:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\aquib> $PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 2 0 -1 -1
Resolve-DnsName
是 Windows 8/Windows 2012 及更高版本中添加的命令之一。 根据设计,无论您使用哪个版本的 PowerShell,在此之前的 Windows 版本中均不可用。该命令在 Windows 7 和 Windows 2008 R2 及更早版本上不可用。我读过的大多数消息来源都说,该命令所依赖的底层 WinAPI 函数是在 Windows 8/2012 中添加的。
我建议使用 [System.Net.Dns]::GetHostEntry($HostnameOrIP)
或 one of the other non-obsolete static methods in that class。但是,这仅适用于 A、AAAA 和 PTR 记录,并且在 .Net Framework CLR 中没有用于通用 DNS 请求的 class。您必须自己滚动或使用像 ARSoft.Tools.Net.