查询区域内所有的A记录
Get-WmiObject -Namespace rootMicrosoftDNS -class microsoftdns_atype | where {$_.ContainerName -eq "com"} |Select TextRepresentation
新增A记录
$dnsServerName=""
$containerName="cowainglobal.com"
$dns = [WMIClass]"ROOTMicrosoftDNS:MicrosoftDNS_ResourceRecord"
$dns.CreateInstanceFromTextRepresentation($dnsServerName, $containerName, "api.uat.sfp.cowainglobal.com IN A 172.16.10.222")
修改A记录
$ARecord = Get-WmiObject -Namespace rootMicrosoftDNS -class microsoftdns_atype | where {$_.OwnerName -eq "oaapi.dev.com"}
$ARecord.Modify($ARecord.TTL,"172.16.10.221")
删除A记录
$ARecord = Get-WmiObject -Namespace rootMicrosoftDNS -class microsoftdns_atype | where {$_.OwnerName -eq "oaapi.dev.com"}
$ARecord.delete()
查询A记录
Get-WmiObject -Namespace rootMicrosoftDNS -class MicrosoftDNS_ResourceRecord -filter "containername='com' AND OwnerName='oaapi.dev.com'"