VMware Cloud Community
TryllZ
Expert
Expert

Disabling vCLS with PowerCLI..?

Hi,

I'm looking for code to disable vCLS for Cluster in vCenter.

I'm aware of the method used to disable in Advanced Settings with the domain value, but not able to find any where how to do it via PowerCLI.

Has anyone got any way to do this with PowerCLI.

Thank You

0 Kudos
5 Replies
LucD
Leadership
Leadership

Yes, something like this for example

$clusterName = 'cluster'
$vClsPresent = $false

$cluster = Get-Cluster -Name $clusterName
$advName = "config.vcls.clusters.$($cluster.ExtensionData.MoRef.Value).enabled"

$advSetting = Get-AdvancedSetting -Entity $global:DefaultVIServer -Name $advName
if($advSetting){
  Set-AdvancedSetting -AdvancedSetting $advSetting -Value $vClsPresent -Confirm:$false
}
else{
  New-AdvancedSetting -Entity $global:DefaultVIServer -Name $advName -Value $vClsPresent -Confirm:$false
}


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

TryllZ
Expert
Expert

Thanks again @LucD,

Will check this tomorrow as well..

0 Kudos
ChrisROI
Enthusiast
Enthusiast

Thanks LucD! Need that too!

0 Kudos
B-Schuteker
Contributor
Contributor

Hey @LucD 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

 

0 Kudos
LucD
Leadership
Leadership

You can find the cluster from the ESXi node

$cluster = Get-VMHost -Name "your-ESXi-hostname" | Get-Cluster
$cluster.Name


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

0 Kudos