尝试从 DNS 获取区域名称时出错



尝试从DNS获取区域名称时出错。

$zoneNames = (Get-DnsServerZone | Where-Object {
$_.IsReverseLookupZone -eq $true
}).ZoneName

错误信息:

术语"Get-DnsServerZone"不被识别为 cmdlet、函数、脚本文件或可操作程序的名称。

如注释中所述,包含Get-DnsServerZonecmdlet 的DnsServer模块随 Windows Server 2012 及更高版本一起提供。

在 2008 R2 上,必须使用dnscmd或查询目标 DNS 服务器上的MicrosoftDNSWMI 命名空间:

$ZoneNames = (Get-WmiObject -Namespace rootMicrosoftDNS -Class MicrosoftDNS_Zone -Filter 'Reverse = true' -ComputerName targetdnsserver.domain.tld).Name

最新更新