Nutanix & Powershell: Restoring a Protection Domain on a remote site

Using Nutanix Acropolis in your infrastructure, you have multiple options to protect your virtualized infrastructure. Using Protection Domain and async replication. So, disaster recovery is very good handled in the Nutanix software. For long term retention of the data, a third party tool is most likely needed for protection.

For a customer, I am replicating all remote locations to one DR cluster. To offload the servers from the Nutanix cluster to the back-up medium I need to restore the virtual machines from a snapshot. When the virtual machines are restored, they can be protected by a solution like Commvault.

To recover a virtual machine from a snapshot, the snapshot ID is needed. I am (yet) not very familiar with scripting using acli and ncli, so I decided to use the Nutanix Powershell cmdlets to recover the VMs.

#Add PSsnapin Nutanix Cmdlets
 Add-PSSnapin -Name NutanixCmdletsPSSnapin

$pass = Get-Content D:\Scripts\Nutanix\pass.txt | ConvertTo-SecureString

#Define variables
$vmprefix = "CV_"
$cip = "[Cluster IP Address] "

#Connect to the cluster
 Connect-NutanixCluster -Server $cip -UserName admin -Password $pass -AcceptInvalidSSLCerts

#Collect Protection Domains
 $pds = Get-NTNXProtectionDomain

foreach ($pd in $pds) {
 #Collect Snapshot Information
 $snap = Get-NTNXProtectionDomain -Name $pd.Name | Get-NTNXProtectionDomainSnapshot

#Restore snapshot
 Restore-NTNXEntity -Name $pd.Name -SnapshotId $snap[0].snapshotId -VmNamePrefix $vmprefix
 }
 #Disconnect from Nutanix Cluster
  Disconnect-NTNXCluster -Servers $cip

Posted

in

,

by

Tags:

Comments

One response to “Nutanix & Powershell: Restoring a Protection Domain on a remote site”

  1. […] of all, the ‘ImageServer’ has to be restored from the latest snapshot. In an earlier post, I described how I use Powershell to restore a VM from a snapshot. A few lines will make sure, you […]

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.