{"id":415,"date":"2015-01-30T16:07:18","date_gmt":"2015-01-30T15:07:18","guid":{"rendered":"http:\/\/lazic.info\/josip\/?p=415"},"modified":"2015-02-01T16:01:42","modified_gmt":"2015-02-01T15:01:42","slug":"changing-multiple-resource-records-in-dns-zone","status":"publish","type":"post","link":"https:\/\/lazic.info\/josip\/post\/changing-multiple-resource-records-in-dns-zone\/","title":{"rendered":"Changing multiple resource records in DNS zone"},"content":{"rendered":"<p>While Microsoft gives nice documentation (<a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/jj649911.aspx\" title=\"\" target=\"\">https:\/\/technet.microsoft.com\/en-us\/library\/jj649911.aspx<\/a>) for Set-DnsServerResourceRecord and Get-DnsServerResourceRecord, there is no example on howto make changes on all records at once. Here is simple PS script for changing TTL on all A records in DNS Zone.<br \/>\n<!--more--><br \/>\n<code>$TTL = [System.TimeSpan]::FromHours(12)<br \/>\n$ZoneName = \"lazic.info\"<br \/>\n$Zone = Get-DnsServerResourceRecord -ZoneName $ZoneName -RRType \"A\"<br \/>\nforeach ($Record in $Zone) {<br \/>\n\t$New = $Old = $Record;<br \/>\n\t$New.TimeToLive = $TTL;<br \/>\n\tSet-DnsServerResourceRecord -NewInputObject $New -OldInputObject $Old -ZoneName $ZoneName -PassThru<br \/>\n}<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>While Microsoft gives nice documentation (https:\/\/technet.microsoft.com\/en-us\/library\/jj649911.aspx) for Set-DnsServerResourceRecord and Get-DnsServerResourceRecord, there is no example on howto make changes on all records at once. Here is simple PS script for changing TTL on all A records in DNS Zone.<\/p>\n<div class=\"clearfix text-center more-button\"><a href=\"https:\/\/lazic.info\/josip\/post\/changing-multiple-resource-records-in-dns-zone\/\" class=\"btn btn-success\">Continue reading<\/a><\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-415","post","type-post","status-publish","format-standard","hentry","category-powershell"],"_links":{"self":[{"href":"https:\/\/lazic.info\/josip\/wp-json\/wp\/v2\/posts\/415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lazic.info\/josip\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lazic.info\/josip\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lazic.info\/josip\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lazic.info\/josip\/wp-json\/wp\/v2\/comments?post=415"}],"version-history":[{"count":0,"href":"https:\/\/lazic.info\/josip\/wp-json\/wp\/v2\/posts\/415\/revisions"}],"wp:attachment":[{"href":"https:\/\/lazic.info\/josip\/wp-json\/wp\/v2\/media?parent=415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lazic.info\/josip\/wp-json\/wp\/v2\/categories?post=415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lazic.info\/josip\/wp-json\/wp\/v2\/tags?post=415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}