I know this post has been up for a while, but I needed to find a solution and decided to share in case anyone ever needs to automate this.
** You need powerCli 13.0 + **
To find the setting:
Get-Cluster myClusterName | Get-VsanClusterConfiguration | select -ExpandProperty CapacityThreshold
Example:
PS C:\Windows\system32> Get-Cluster wl-cluster01 |Get-VsanClusterConfiguration |select -ExpandProperty CapacityThreshold
Enabled RedValue YellowValue Target
------- -------- ----------- ------
True 85 75 VsanDatastore
To enable and change the value:
Get-Cluster myClsuter |Set-VsanClusterConfiguration -CapacityThreshold (New-VsanHealthCheckThreshold -Enabled $true -RedValue 85 -YellowValue 75 -Target VsanDatastore)
Get-Cluster wl-cluster01 |Set-VsanClusterConfiguration -CapacityThreshold (New-VsanHealthCheckThreshold -Enabled $true -RedValue 85 -YellowValue 75 -Target VsanDatastore)
Cluster VsanEnabled IsStretchedCluster Last HCL Updated
------- ----------- ------------------ ----------------
wl-cluster01 True False 2023-02-22 8:00:00 AM
Hope this helps!