PowerCLI

 View Only
  • 1.  Disabling vCLS with PowerCLI..?

    Posted Dec 19, 2021 08:13 PM

    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



  • 2.  RE: Disabling vCLS with PowerCLI..?

    Posted Dec 19, 2021 09:07 PM

    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
    }


  • 3.  RE: Disabling vCLS with PowerCLI..?

    Posted Dec 19, 2021 09:21 PM

    Thanks again ,

    Will check this tomorrow as well..



  • 4.  RE: Disabling vCLS with PowerCLI..?

    Posted Apr 19, 2023 01:41 PM

    Thanks LucD! Need that too!



  • 5.  RE: Disabling vCLS with PowerCLI..?

    Posted Apr 18, 2024 05:30 PM

    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

     



  • 6.  RE: Disabling vCLS with PowerCLI..?

    Posted Apr 18, 2024 06:16 PM

    You can find the cluster from the ESXi node

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