11

Automating Rubrik VM protection 3 different ways

 3 years ago
source link: https://virtuallysober.com/2019/06/24/automating-rubrik-vm-protection-3-different-ways/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Automating Rubrik VM protection 3 different ways

Published June 24, 2019 by Joshua Stenhouse
0
RubrikAutoVMProtectionBannerv1-2.png?fit=1869%2C781&ssl=1

I recently had 3 Rubrik customers asking for ways to automate protecting VMs by a means not available in the UI. Any use case is possible when you have an API first platform, so in this post I’m going to share with you the scripts I created for them.

The first request was a script to automatically protect VMs with an SLA domain based on a string within the VM name, because they had 1000s of VDI VMs with no consistent VM folder or tag. The second was a CSV list of VM and SLA names, with the VMs automatically protected based on the list.  The third was to export a list of all VMs from Rubrik, edit the CSV output with the new SLA settings, then import to apply the new settings.

With all 3 they wanted to see what would happen first before applying the protection, with credentials saved securely so it could run headless on a schedule going forward. If you are thinking at this point, what about VM tags? I already shared that, you can find it here.

To get you started download the zip file below:

In the zip file you’ll find the following scripts:

  • RubrikAutoVMProtectv1-ByVMName.ps1 – Finds the VMs with a matching string and protects them with the SLA specified.
  • RubrikAutoVMProtectv1-ImportByName.ps1 – Imports any CSV using VMName and NewSLADomain columns to then apply the SLA.
  • RubrikAutoVMProtectv1-Export.ps1 – Exports all the VMs that the Rubrik cluster can see to a CSV for configuration.
  • RubrikAutoVMProtectv1-Import.ps1 – Imports the above CSV and applies the NewSLADomain specified. Also useful for making bulk SLA reassignments, and this can be used to explicitly set DoNotProtect on a VM by changing the NewSLADomain field to DoNotProtect.

With all 4 scripts configure the $RubrikCluster and $ScriptDirectory variables to match your environment and you are good to go. By default they all have $DryRunEnabled = $True to show you what they would do, change it to False to apply the SLAs defined.

Hope you found these useful. Happy scripting,

@JoshuaStenhouse

Like this:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK