Automation

 View Only
  • 1.  Get VMtools component version from Single Image Cluster

    Posted Jul 29, 2024 04:07 AM

    Hi coders,

    I am developing a script to automate updating our single image clusters (as we have over 160 clusters with the same hardware!), but I am looking for a means to skip a cluster if the target cluster is the same as my source cluster.

    I have tried a means to compare clusters, but that does not appear to be a thing, so I seem to need to dig deeper and compare the JSON images.

    Unfortunatey you cannot simply export the single image settings to an array without saving a file, so instead of saving over 160 meaningless JSON files every time I run the script, I figure the most often changed component for us is the VMtools component, so I want to use a combination of the VMtools version and base image version to check if my cluster needs to be updated.

    I don't want to check the version installed on the host, as my parity for the clusters should be the image itself.

    I can easily get the cluster base image version, but for the life of me I cannot get the component version for the VMware Tools Async Release - the nearest I can get is a Get-Cluster command...

    Get-Cluster -Name $SrcClusName | Select-Object -Property @{n='Components'; e={$_.Components.Name}}
    
    Components                                                                                                                                                  
    ----------                                                                                                                                                  
    {Cisco Ethernet native driver, Cisco Fibre Channel native driver, Network driver for Intel(R) X722 and E810 based RDMA Adapters, VMware Tools Async Release}

    Does anyone know how I can discover the VMtools component version of a Single Image Clusters image?



  • 2.  RE: Get VMtools component version from Single Image Cluster

    Posted Jul 29, 2024 02:36 PM

    I have since found a script from William Lam (Broadcom), and singled out the lines I needed:
    vmware-scripts/powershell/Get-vLCMClusterImageInformation.ps1 at master · lamw/vmware-scripts

    Resulting script looks like this:

    # Discover the VMtools version in the source single image cluster image
    $SrcClusMoRef = (Get-Cluster -Name $SrcClusName).ExtensionData.MoRef.Value
    $SrcClusSw = Invoke-GetClusterSoftware -Cluster $SrcClusMoRef
    $SrcClusVMt = $SrcClusSw.components.'VMware-VM-Tools'.version
    Write-Host "VMtools version: $SrcClusVMt"



  • 3.  RE: Get VMtools component version from Single Image Cluster

    Posted Jul 30, 2024 05:30 AM
    Edited by rkabelich Jul 30, 2024 05:35 AM

    Carl, for simple Information you may also use: 

    $VM = Get-Cluster "your Cluster" | Get-VM
    
    $vm | where {$_.Name -notlike "vcls*"} | 
    select Name,
    @{N="VMTools Version";E={$_.ExtensionData.Guest.ToolsVersion}},
    @{N="VMTools Version Status";E={$_.ExtensionData.Guest.ToolsVersionStatus}},
    @{N="VMTools Status";E={$_.ExtensionData.Guest.ToolsStatus}},
    @{N="VMTools Running Status";E={$_.ExtensionData.Guest.ToolsRunningStatus}}