Unprotect VMs from Protection Domain NCLI | Nutanix Community
Skip to main content

Hi there,

I have many PDs and inside these PDs I have many VMs. I want to be able to run NCLI (or the like) to unprotect VM’s using a wildcard if possible. Example:

ncli pd unprotect name=ProtectionDomain vm_name=VM*

Anyone have an idea on how to do this to unprotect machines by wildcard to remove a mass amount at once?

Hi Aaron,

unfortunately, the traditional wildcard will not work there. You can use the following for-loop as a workaround:

for i in $(ncli pd list name=<PD-NAME> | grep "VM Name" | grep "<PART-OF-VM-NAME>" | awk {'print $NF'}); do ncli pd unprotect name=<PD-NAME> vm-names=$i; done

Just replace the <PD-NAME> from in the command above with the name of the Protection Domain and replace <PART-OF-VM-NAME> with what you would write before the * as if you used the wildcard. For example, if you want to remove only the VMs from the PD that have “accounting” in their name, put “accounting” there.

I know it is not a beautiful solution and it is rather slow, but it works.


I think that is exactly what I am looking for actually...i will test this out. thank you!


works like a charm...you’re right, a bit slow, but it does what i want! thanks!!