Apr
17

NOS 4.0 PowerShell – Add All Your VMs To A Protection Domain

There has been some requests from customers including on the Nutanix Next Community Site asking for a way to automatically add all the VM’s to a protection domain or at least have a default. Good thing about still using per-VM replication in this use case is that we are not sending the vswap files across the network\WAN. If the data has been deduped already and sent over the wire, you wont have send that as well.

Using PowerShell you can accomplish this with just two lines of code, maybe 1 if your smarter than me (not hard!)


$unprotectedvms = Get-UnprotectedVms
foreach($x in $unprotectedvms){ Add-VmsByNamesToProtectionDoman -name PD-2 -Names $x.vmName}

Nutanix PowerShell

Thankfully you can remove them out of the protection domain easily too.

Comments

  1. One-liner: Get-UnprotectedVms | %{ Add-VmsByNamesToProtectionDoman -name PD-2 -Names $_.vmName}

    Not tested as I don’t have access to NOS4.0 right now.

Speak Your Mind

*