Hey can you help me please? Thank you in advance.
I have a script that patches my ESXi hosts but I need it to be able to disable vCLS so that it can place the host in maint mode and I was pointed to this post. This script needs to be able to be run on multiple systems that are not configured the same. The script is run separately on each host and the hostname variable is passed to the script via a .bat file. There are 2 types of systems, each one has 2 hosts that are each in their own cluster but the clusters are not named the same so I need it to retrieve the name of the cluster that the host is in so that it can be placed in MM. I have the following working but it returns both clusters and not the cluster for the individual host:
Connect-VIServer -Server $vCSA -Credential $vcsaCred
$cluster - Get-Cluster -Server $vCSA
$clusterName = $cluster.Name