2

In preparation to enable DNS Aging/Scavenging, one point brought up to us are our printers (have a little over a 1000) and having DNS failing to update. All Zones are Active Directory-Integrated. I am trying to figure out the best approach to set these to a static record. All the printers start with the same prefix for the name in DNS (xxx...102, xxx...103, xxx...104). I am pondering two options.

A:) Convert all the printer records to static records without having to manually edit each record. Is there a way I can do a filter for the printer prefix and convert them to static records from DNSCMD?

B:) Export all printer records that match a filter with the printer prefix and then import them as a static record?

Guidance would be appreciated for either of these options or another viable alternative. Any other advice for enabling DNS Aging/Scavenging for a large enterprise would be of course welcomed.

Thanks.

1
  • So the A records for the printers are dynamic?
    – joeqwerty
    Sep 3, 2014 at 23:36

2 Answers 2

4

@Massimo is partially correct, in that you can use Set-DnsServerResourceRecord for this, but you cannot directly set the timestamp as that property is considered read only. Instead, any change you make will result in the record becoming static.

Here's a sample of how you might go about that:

$dnsServer = 'MyDC01'
$zone = 'contoso.com'
$records = Get-DnsServerResourceRecord -ComputerName $dnsServer -ZoneName $zone -RRType A | Where-Object { $_.HostName -like 'printer*' }

$records | ForEach-Object {
    Set-DnsServerResourceRecord -OldInputObject $_ -NewInputObject $_ -ComputerName $dnsServer -ZoneName $zone
}

This should be non-destructive since the input and output objects are the same, but be careful, have backups!

Regarding Scavenging

If your printer's records are already dynamic (perhaps because they are configured via DHCP and DHCP is refreshing them), then you probably should not make them static. If DHCP and dynamic DNS are working properly, then the dates will update, and scavenging won't hurt them.

If the printers are DHCP but the timestamps are not updating, then you should figure out why and resolve the problem before enabling scavenging.

If you must make these static, DHCP should be configured for those scopes or for those individual reservations not to dynamically update DNS.

Note about timestamps

You must enable scavenging on the AD integrated zones before timestamps will replicate. If it looks like the dates are all wrong and inconsistent you may be running into this. Enabling scavenging on the zone does not scavenge records (that setting is on the server). I had scavenging enabled on the zones for 2 months before I actually set scavenging to run, so that I could be sure the timestamps were consistent and being updated.

0

In Windows DNS, a record is defined as static if it doesn't have a timestamp; thus, the answer you are looking for is "get all those records and set their timestamp to 0".

This can be done quite easily with PowerShell on Windows Server 2012, which introduces a series of PowerShell cmdlets for working with DNS; the ones you are looking for are Get-DnsServerResourceRecord and Set-DnsServerResourceRecord, which should let you build a script like this:

- Get all records of type A for your DNS zone
- Filter them to select the ones starting with the prefix you want
- For each record:
    - Set the timestamp to 0
    - Save the record

Please note that you don't need your DNS servers to run Windows Server 2012 for this to work; you only need to run the script on a WS2012 or WS2012R2 machine. In a pinch, even a computer running Windows 8 or Windows 8.1 will work, but you'll need to install the Remote Server Administration Tools on it.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .