• This topic has 30 replies, 3 voices, and was last updated August 9, 2023 by Arjun K.

Update VM DNS after Failover

  • Does anyone have suggestion on the best way to update dns or AD Object after moving to another datacenter after a failover?

     

    I am considering running a post script to force update of servers DNS once on new IP.

     

    thanks

    Hey Matt,

    Just for testing purposes, do you know how i would change the account that Zerto Runs the script? Should i just update the Log on Service?

     

    Thanks

    It’s the account that the windows service runs as.

    OK cool, thats what i was thinking. I updated it from the local account to the Zerto Service account i created.

    I will now configure the VPG with a Pre Script of the following

     

    Command : Powershell.exe

    Parameter : c:\scriptfolder\script.ps1

     

    Just to confirm, does that look right to execute Powershell?

     

    Thanks !

     

    I cannot confirm that as I do not use powershell for this. I use batch. I suggest you open a support ticket.

    Hey Guys,

    Its was the Service Account for the Zerto Service on the ZVM.

     

    Make sure to update this everybody to your service account you have given your DNS permissions to  and then restart the service and try again.

    This format worked for me

     

    Command : Powershell.exe

    Parameter : c:\scriptfolder\script.ps1

    Works like a charm now, when i failover it modifies the DNS of the VPG VM’s to whatever the DNS should be at the Protection Site.

    Thank you Matthew and Harry Big Helps here!!!

     

    That format worked Matt.

    thanks for the help man !

    Hey Matt,

    I just ran a test and it did execute the script as well, is this suppose to happen? Should i just clear out the config if im running at test?

    Thanks

    I would open a support ticket. Their support team can run this down best for you.

    Yes, I wanted to update you on that, in that the script will be called by default whether a Failover, Failover Test, or Move operation is called. See the documentation here  (or goto our Technical Documentation, vSphere Admin Guide for ZVR, then “Running Scripts Before of After Recovering a VPG”).

    This gives you parameters to insert to determine which operations will actually invoke the scripts.

    Hope this helps and thanks for the insight and help to both of you!

    ~Harry

    Follow me: www.twitter.com/HarrySiii

    see:

    “<span class=”CodeInLine”>%ZertoOperation%</span> – The operation being run: <span class=”CodeInLine”>FailoverBeforeCommit</span>, <span class=”CodeInLine”>FailoverRollback</span>, <span class=”CodeInLine”>Test</span>, <span class=”CodeInLine”>MoveBeforeCommit</span>, <span class=”CodeInLine”>MoveRollback</span>. Use the result returned for this variable to limit when the script runs, dependent on the operation. The scripts are run after all the virtual machines are powered on at the recovery site and the variable is set to <span class=”CodeInLine”>FailoverBeforeCommit</span> or <span class=”CodeInLine”>MoveBeforeCommit</span>. Use <span class=”CodeInLine”>FailoverRollback</span> or <span class=”CodeInLine”>MoveRollback</span> when rolling back the Failover or Move operation, to undo whatever changes a previous script has done (such as updating the DNS records).”

    ~Harry

    Follow me: www.twitter.com/HarrySiii

    Yeah ok, I stand corrected. Scripts do get called during a test failover. I’m clearly mis-remembering this. I could of sworn that post-scripts do not execute during a test failover. If you think about it, why would you ever want to run a script in production, if you’re doing a test failover? That doesn’t seem logical to me. The production server will be impacted in this case. I certainly don’t want to do anything that will impact production, during a test failover. The test failover feature’s biggest claim to fame is that it allows me to test, without impacting production. This is certainly good to know, just a bit perplexing as to why it is that way. I’m almost positive I asked support about this years ago, and they said a test failover would not execute post scripts, but I must be wrong.

    Hey Guys,

    I wrote up a quick post on this topic to consolidate all the steps and information on how to update DNS and execute a powershell script.

    Check it out:

    DNS Pre / Post – Recovery Script:

    Thanks again guys Great work!

    AnyCast. Talk to your network team / vendor. We are implementing this now and it has not only addressed this issue in full but made DNS much more flexible and easy to manage.

    Tagged: 

    Any new updates on this or different way to tackle it with V7.5 or v8?

    Am I missing something? You can setup failover DNS settings against each server in their VPGs. Why are you not using this?

    The other thing to do is to place an always-connected DNS server in the DR site and the production/replicated servers should have this as a 3rd DNS server so when they are failed over, the first 2 DNS servers will not be available, however the 3rd one will be.

You must be logged in to create new topics. Click here to login