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:
Thanks
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.
$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
You could do something like this
$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
Thanks for the quick answer. after executing your answer i got list of two datastores but they are not checked:
what i need to do more to have the boxes checked?
Thanks
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.
$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
Thanks with some modification in my ESX and your answer i managed to checked them