DNS – Remove DNS records on schedule

Sometimes you need to remove the DNS records at a night time or early in the morning, for example before users logs on. Say you want to perfom a maintenance work on a server. Here how you can do this.

You need a script and a task scheduler.
Script – just a simple .cmd [call it say “RemoveDNS.cmd”] file with the commands like these:

dnscmd /RecordDelete yourdomain.com server1.yourdomain.com. A /f
dnscmd /RecordDelete yourdomain.com server2.yourdomain.com. A /f

Scheduler – you need a scheduler that is able to use custom user credentials, user who have rights to modify DNS records. at.exe won’t work as it uses System account. But the built-in Windows Task Scheduler will do the work.
TS1 Continue reading