Looking to use powercli to configure specified host failover admission control policy. I need to be able to set one or many hosts. I can see its not in a cmdlet, but assume someone has figured out how to do it via the sdk. Any help is appreciated.
I assume you mean something like this?
In line 3, the script takes the first ESXi node of the cluster as the failover host, but you can pick any combination of ESXi nodes from the cluster.
You just need to make sure that the $esxMoRef contains the MoRefs of the selected ESXi node(s)
$clusterName = 'MyCluster'
$clus = Get-Cluster -Name $clusterName
$esxMoRef = Get-VMHost -Location $clus | Select -First 1 | %{$_.ExtensionData.MoRef}
$spec = New-Object VMware.Vim.ClusterConfigSpec
$spec.DasConfig = New-Object VMware.Vim.ClusterDasConfigInfo
$spec.DasConfig.Enabled = $true
$spec.DasConfig.AdmissionControlPolicy = New-Object VMware.Vim.ClusterFailoverHostAdmissionControlPolicy
$spec.DasConfig.AdmissionControlPolicy.failoverHosts = $esxMoRef
$clus.ExtensionData.ReconfigureCluster($spec,$true)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I assume you mean something like this?
In line 3, the script takes the first ESXi node of the cluster as the failover host, but you can pick any combination of ESXi nodes from the cluster.
You just need to make sure that the $esxMoRef contains the MoRefs of the selected ESXi node(s)
$clusterName = 'MyCluster'
$clus = Get-Cluster -Name $clusterName
$esxMoRef = Get-VMHost -Location $clus | Select -First 1 | %{$_.ExtensionData.MoRef}
$spec = New-Object VMware.Vim.ClusterConfigSpec
$spec.DasConfig = New-Object VMware.Vim.ClusterDasConfigInfo
$spec.DasConfig.Enabled = $true
$spec.DasConfig.AdmissionControlPolicy = New-Object VMware.Vim.ClusterFailoverHostAdmissionControlPolicy
$spec.DasConfig.AdmissionControlPolicy.failoverHosts = $esxMoRef
$clus.ExtensionData.ReconfigureCluster($spec,$true)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Master Luc! I was so close...