2017-07-06 75 views
0

嘗試從DNS獲取ZoneName時出現錯誤。嘗試從DNS獲取ZoneName時出現錯誤

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

錯誤消息:

術語 'GET-DnsServerZone' 未被識別爲cmdlet,函數,腳本文件或可操作的程序的名稱。

+0

'添加-WindowsFeature RSAT-DNS-Server'。這隻適用於Windows的服務器安裝。 –

+0

@JeroenMostert 執行上述命令,但仍然收到相同的錯誤。 – VENKATESH

+1

該cmdlet是DnsServer模塊的一部分,該模塊應該在您調用該cmdlet時自動加載。 「Import-Module DnsServer」說什麼? (你的Windows有哪些版本和版本?) –

回答

1

正如評論中所述,包含Get-DnsServerZone cmdlet的DnsServer模塊隨Windows Server 2012及更新版本一起提供。

2008 R2上,你必須爲使用dnscmd或查詢目標DNS服務器上的MicrosoftDNS WMI命名空間:

$ZoneNames = (Get-WmiObject -Namespace root\MicrosoftDNS -Class MicrosoftDNS_Zone -Filter 'Reverse = true' -ComputerName targetdnsserver.domain.tld).Name 
相關問題