Powershell to update TTL of multple A Records from a file, each A record having multiple IP's

Biju Thankappan 86 Reputation points
2022-01-24T01:39:19.46+00:00

Hi,

I'm referring to the below article from MS. However, the ttl values do not update as expected even after using the same commands as per this article:

https://learn.microsoft.com/en-us/powershell/module/dnsserver/set-dnsserverresourcerecord?view=windowsserver2022-ps

Few queries:

How to update the tl for A records having multiple IP's?

Does the ttl values updated for soa record ensure new records are updated with this updated ttl value?

Regards,

TIA

Windows DHCP
Windows DHCP
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.DHCP: Dynamic Host Configuration Protocol (DHCP). A communications protocol that lets network administrators manage centrally and automate the assignment of Internet Protocol (IP) addresses in an organization's network.
1,021 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,346 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 44,621 Reputation points
    2022-01-24T02:50:12.413+00:00

    "A" records don't have multiple IP addresses. What you have are multiple "A" records, each with their own IP address.

    Treat the results of the Get-DnsServerResourceRecord the same way you'd treat anything that returned (possibly) multiple objects:

    Get-DnsServerResourceRecord -Name BOGUS -ZoneName ATHOME.COM -RRType A |
        ForEach-Object{
            $NewRecord = $_.Clone()
            $NewRecord.TimeToLive = New-TimeSpan -hours 2
            Set-DnsServerResourceRecord -NewInputObject $NewRecord -OldInputObject $_ -ZoneName athome.com
        }
    

    The SOA record sets the minimum TTL for resource records. Whether that applies to new records only, or to all records in a zone, or to just all records in a zone that have a TTL lower than the SOA calls for I don't remember.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful