Setting vSphere Cluster Setting 'VM dependency restart condition' via PowerCLI

A colleague requested some assistance as to whether it was possible to configure the vSphere Cluster Setting ‘VM dependency restart condition’ via PowerCLI. If you’re not familiar with this setting, it can be found in the vSphere Client web interface by editing the vSphere Availability cluster settings:

Digging around in the ExtensionData of a Cluster object in PowerCLI got us close, but it would appear that this value is not currently visible. (If you know where to find it, please let me know in the comments)


However, looking through some of the API documentation gave us some info on how to change the value that is set. The below document lists possible values for a ClusterVmReadinessReadyCondition:

Combined with these two other docs, we were able to code a solution:

For example to set the readyCondition to guestHbStatusGreen: