VMware Cloud Community
jcouch
Enthusiast
Enthusiast
Jump to solution

Configure admission control failover host via powercli

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.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
jcouch
Enthusiast
Enthusiast
Jump to solution

Thanks Master Luc! I was so close...

0 Kudos