Home > Blogs > VMware PowerCLI Blog

Want to Change VM Component Protection Settings via PowerCLI? Now you can!

I had a VMware Senior Systems Engineer reach out to me yesterday asking on a customer’s behalf, if there were any PowerCLI cmdlets that could change VMCP settings.

*** If you are not familiar with VM Component Protection, I suggest you take a look at this blog post written by my co-worker Matt Meyer, which describes in detail what VMCP is and what each setting does: https://blogs.vmware.com/vsphere/2015/06/vm-component-protection-vmcp.html ***

I knew that we didn’t have any cmdlets for this yet so the next step for me was to jump into the vSphere Web Client to take a look at exactly which VMCP settings a user could set in the GUI.

To get to the VM Component Protection settings, right-click on a cluster and select ‘Settings’.

2015-10-28 (1)

Next, Select ‘vSphere HA’ and click ‘Edit’.

2015-10-28 (12)

You will need to ensure that vSphere HA is enabled to edit any further settings. Once enabled, you can select “Protect against Storage Connectivity Loss” under the Host Hardware Monitoring – VM Component Protection section. However, just enabling this is not quite enough. You will also need to expand the ‘Failure conditions and VM response’ section down below.

2015-10-28 (4)

Here you will see four options. If you haven’t yet read the referenced blog post above, I suggest that you take a look at it now to understand each of these settings. I will not go into it as it has already been documented. Just know, that these are the settings and the drop-downs have each option available.

2015-10-28 (5)


Ok, now that you’ve seen the VMCP settings, let’s get into the two advanced functions I created to work with it.

The first advanced function is called Get-VMCPSettings. The only parameter needed is –cluster. This can be passed either as a string, or as the cluster object itself:

$cluster = Get-Cluster LAB-CL

Get-VMCPSettings –Cluster $cluster


Get-VMCPSettings –Cluster LAB-CL

You will see all the associated information is returned in a neatly formatted output.

2015-10-28 (6)

If you plan on changing the settings, you will use the Set-VMCPSettings advanced function:

All the parameters in this function are required, however, to make it much easier for you, I’ve added all possible values for each parameter into the function, meaning, as you type the dash “-“ and hit ‘Tab’ it will auto-complete the parameter name. by pressing the spacebar and hitting the ‘Tab’ button again you will be able to tab through all possible values for that parameter. This makes using the function much easier as you don’t have to worry about memorizing the possible values, or potentially misspelling words.

You will see that the results are displayed once the function completes.

2015-10-28 (13)

You can always go and double-check the settings in the vSphere Web Client under the HA settings window.

2015-10-28 (11)

Want to give it a try?

You can grab this module in the VMware PowerCLI-Example-Scripts github repo HERE: https://github.com/vmware/PowerCLI-Example-Scripts/blob/master/VMCPFunctions.psm1

This entry was posted in General, Learning, Performance, vCenter and tagged , , , on by .
Brian Graf

About Brian Graf

Brian Graf is a well-known VMware evangelist in the IT community. Over the past 5 years, Brian has done Technical Marketing for PowerCLI Automation and ESXi Lifecycle, Product Management of vCenter Distributed Resource Management features (DRS & HA), and is currently working as a Technical Marketing Manager for VMware Cloud on AWS. Brian is a co-author of the PowerCLI Deep Dive 2nd edition book. He has helped develop VMware certification courses and exams and presents around the world at VMware User Conferences, AWS Summits, Interop, as well as other industry Conferences. Brian is also a Microsoft MVP.

7 thoughts on “Want to Change VM Component Protection Settings via PowerCLI? Now you can!

  1. Pingback: Now you can change VM Component Protection… | vcdx181

  2. sydfireworks.com.au

    What’s up, its fastidious piece of writing abo&#6489t media print, we
    all Ƅe familiar with media іѕ a enormous
    source οf data.

    Feel free t&#1086 visit my web site …

  3. Pingback: VM Component Protection (VMCP) | Family Janosek

  4. voyance cartomancie

    Thanks for finally talking about >Change VMCP settings with PowerCLI – VMware Blogs <Loved it!

  5. Dustin Haugen

    The link to the function is dead.

    1. Dudi Avrahamov

      I found the correct link:

      Thanks for Brian for the implementation!
      You are a star!

  6. Pinoy Tv Replay Shows

    I like your post and also like your website because your website is very fast and everything in this website is good. Keep writing such informative posts. I have bookmark your website. Thanks for sharing.


Leave a Reply

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