the script is correct?

John JY 221 Reputation points
2022-04-26T01:22:28.457+00:00

Hi all,

the script in the link below is correct? Can anyone share? Thank you!
https://serverfault.com/questions/626092/converting-dynamic-dns-records-to-static

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,459 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 45,831 Reputation points
    2022-04-26T01:49:19.677+00:00

    Why don't you pick one A record and just run the Get-/Set-DndServerRecord with that?

    The problem is that if the host updates the record after that (because it's configured that way) it'll probably set a new timestamp on the record. You should check to see if the box that says to delete the record when it becomes stale is checked on the A record after it's been modified (assuming that you're trying to prevent the record from being scavenged).


  2. Limitless Technology 39,511 Reputation points
    2022-04-29T08:32:58.917+00:00

    Hi there,

    Assuming you still have the DHCP server in place, then you should not need to do this. Windows should be regularly updating the DHCP lease. if nothing else, reboot the server.

    If you're using Windows DNS you can try using the cmdlet Set-DnsServerResourceRecord from the DnsServer module:

    $NewObj = $OldObj = Get-DnsServerResourceRecord -Name "Host01" -ZoneName "contoso.com" -RRType "A"
    $NewObj.TimeToLive = [System.TimeSpan]::FromHours(2)
    Set-DnsServerResourceRecord -NewInputObject $NewObj -OldInputObject $OldObj -ZoneName "contoso.com" -PassThru

    DnsServer https://learn.microsoft.com/en-us/powershell/module/dnsserver/?view=windowsserver2022-ps&viewFallbackFrom=win10-ps

    How to Convert a Dynamic Resource Record to a Static One Without Re-Creating it in DNS https://social.technet.microsoft.com/wiki/contents/articles/21726.how-to-convert-a-dynamic-resource-record-to-a-static-one-without-re-creating-it-in-dns.aspx

    -------------------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments