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 /f
dnscmd dnsservername /RecordAdd domain.com vmhostname a 

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 *