Protecting your Citrix desktops on Nutanix using powershell

Another week, another idea comes up to check if I could make it happen with Powershell. I wanted to write a script that checks my current machine catalog and puts VMs that are not in a Nutanix Protection Domain in a PD to make sure that we can protect those VMs using the policies Nutanix offers.

The following tasks had to be automated using powershell:

  • Check if a machine catalog is persistent
  • Get all desktops in the machine catalog
  • Check if there’s a Nutanix Protection Domain available with a certain prefix (read more here).
  • Check if the VM isn’t already protected
  • Check if the VM can be added there
    • If so: Add the VM
    • If not: create a Protection Domain and add the VM(s) there

I took the liberty of borrowing bits and pieces of Steven Poitras that is published on the Nutanix GitHub here:NTNX-Protect-VM.ps1 (Powershell script) and Sandeep has been helped me by answering my questions patiently. 

 

Here’s the script:

 

The following two tabs change content below.

Kees Baggerman

Kees Baggerman is a Staff Solutions Architect for End User Computing at Nutanix. Kees has driven numerous Microsoft and Citrix, and RES infrastructures functional/technical designs, migrations, implementations engagements over the years.

One comment

  1. […] They were looking for a way to only keep one image updated and they are then looking to use our Protection Domain to replicate it over to the other cluster. Now, they are looking for some automated way to promote […]

Leave a Reply

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