question

JohnJY-4666 avatar image
0 Votes"
JohnJY-4666 asked RichMatheisen-8856 commented

the script is correct?

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered RichMatheisen-8856 commented

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).

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@RichMatheisen-8856 what exactly $_ mean after -OldInputObject & -NewInputObject ? Thank you!

0 Votes 0 ·

It's a reference to the "current object" in the pipeline.

0 Votes 0 ·
JohnJY-4666 avatar image JohnJY-4666 RichMatheisen-8856 ·

@RichMatheisen-8856 what exact value of the current object in the example of the link? Thank you!

0 Votes 0 ·
Show more comments
LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

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://docs.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–

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.