Try like this, there are in fact three possible combinationes (Low, Medium and High)
$clusterName = 'MyCluster'
$HMSensitivity = @(
@{
Name = 'Low'
MinUptime = 480
FailureInterval = 120
MaxFailureWindow = 604800
},
@{
Name = 'Medium'
MinUptime = 240
FailureInterval = 60
MaxFailureWindow = 86400
},
@{
Name = 'High'
MinUptime = 120
FailureInterval = 30
MaxFailureWindow = 3600
}
)
# Query the setting
$cluster = Get-Cluster -Name $clusterName
$cluster | Select Name,
@{N='Heartbeat Monitoring Sensitivity';E={
$sensitivity = $HMSensitivity | where{$_.MinUptime -eq $cluster.ExtensionData.ConfigurationEx.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MinUpTime}
$sensitivity['Name']
}}
# Change the setting
$request = 'Low' # Use Low, Medium or High
$sensitivity = $HMSensitivity | where{$_.Name -eq $request}
$spec = New-Object VMware.Vim.ClusterConfigSpec
$spec.DasConfig = New-Object VMware.Vim.ClusterDasConfigInfo
$spec.DasConfig.DefaultVmSettings = New-Object VMware.Vim.ClusterDasVmSettings
$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings = New-Object VMware.Vim.ClusterVmToolsMonitoringSettings
$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MinUpTime = $sensitivity['MinUpTime']
$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.FailureInterval = $sensitivity['FailureInterval']
$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MaxFailureWindow = $sensitivity['MaxFailureWdinow']
$cluster.ExtensionData.ReconfigureCluster($spec,$true)
# Query the setting
$cluster = Get-Cluster -Name $clusterName
$cluster | Select Name,
@{N='Heartbeat Monitoring Sensitivity';E={
$sensitivity = $HMSensitivity | where{$_.MinUptime -eq $cluster.ExtensionData.ConfigurationEx.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MinUpTime}
$sensitivity['Name']
}}