Update DNS with a Batch Script

Here’s a simple script that can be used to update “A” records. In my experience this is the script I use with Site Recovery Manager during failovers to update DNS entries.

 

@echo off
dnscmd dnsservername /RecordDelete domain.com vmhostname a 192.168.1.5 /f
dnscmd dnsservername /RecordAdd domain.com vmhostname a 192.168.2.5 

Some items to consider…

  • DNS management features need to be installed on the server running the script (I typically add the feature to the SRM server)
  • The AD user account or service account running the script needs to have permissions

 

You can add this script to your recovery plans in SRM by storing the batch script on your SRM server and having it executed.

 

Leave a Reply

Your email address will not be published. Required fields are marked *