the script is correct?

John JY 221 Reputation points

Hi all,

the script in the link below is correct? Can anyone share? Thank you!

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

    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

    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 "" -RRType "A"
    $NewObj.TimeToLive = [System.TimeSpan]::FromHours(2)
    Set-DnsServerResourceRecord -NewInputObject $NewObj -OldInputObject $OldObj -ZoneName "" -PassThru


    How to Convert a Dynamic Resource Record to a Static One Without Re-Creating it in DNS


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

    0 comments No comments