VMware Cloud Community
airaqi
Enthusiast
Enthusiast
Jump to solution

Vmware PowerCLI | Select datastore in "Heartbeat datastores" wizard.

Hi,

Can i get a help with vmware powercli to check 3 the datastores in "heartbeat datastores" as you can see in the attached shot:

pastedImage_0.png

Thanks

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Are all datastores mounted on all ESXi nodes in the cluster?

The numbers don't seem to correspond (4 vs 2).

And do you want to exclude a specific datastore?

The following defines all possible datastores as heartbeat datastores.

If you want to exclude a specific datastore, the code needs to be adapted with a Where-clause.

$clusterName = 'cluster'

$cluster = Get-Cluster -Name $clusterName


$haConf = $cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo()


$spec = New-Object VMware.Vim.ClusterConfigSpec

$Spec.DasConfig = New-Object VMware.Vim.ClusterDasConfigInfo


$haConf.HeartbeatDatastoreInfo |

ForEach-Object -Process {

    $spec.DasConfig.HeartbeatDatastore += $_.Datastore

}

$cluster.ExtensionData.ReconfigureCluster($spec,$true)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

4 Replies
LucD
Leadership
Leadership
Jump to solution

You could do something like this

$clusterName = 'cluster'

$cluster = Get-Cluster -Name $clusterName

$haConf = $cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo()

$haConf.HeartbeatDatastoreInfo |

Select @{N='Datastore';E={(Get-View -Id $_.Datastore -Property Name).Name}},

    @{N='Hosts mounting datastore';E={$_.Hosts.Count}},

    @{N='VMHost';E={(Get-View -Id $_.Hosts -Property Name).Name -join ' | '}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

airaqi
Enthusiast
Enthusiast
Jump to solution

Thanks for the quick answer. after executing your answer i got list of two datastores but they are not checked:

pastedImage_0.png

what i need to do more to have the boxes checked?

Thanks

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Are all datastores mounted on all ESXi nodes in the cluster?

The numbers don't seem to correspond (4 vs 2).

And do you want to exclude a specific datastore?

The following defines all possible datastores as heartbeat datastores.

If you want to exclude a specific datastore, the code needs to be adapted with a Where-clause.

$clusterName = 'cluster'

$cluster = Get-Cluster -Name $clusterName


$haConf = $cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo()


$spec = New-Object VMware.Vim.ClusterConfigSpec

$Spec.DasConfig = New-Object VMware.Vim.ClusterDasConfigInfo


$haConf.HeartbeatDatastoreInfo |

ForEach-Object -Process {

    $spec.DasConfig.HeartbeatDatastore += $_.Datastore

}

$cluster.ExtensionData.ReconfigureCluster($spec,$true)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

airaqi
Enthusiast
Enthusiast
Jump to solution

Thanks with some modification in my ESX and your answer i managed to checked them

0 Kudos