PowerCLI

 View Only
  • 1.  FoundationCoreAndTiBUsage Script with vCenter in return

    Posted Jan 23, 2024 04:00 PM

    Hi there,

    we are using William Lams Script FoundationCoreAndTiBUsage

    from KB 95927 

    Now I want to see the vCenter on return too I tried it that way:

     

     

    $tmp = [pscustomobject] @{
                    VCENTER = $global:DefaultVIServer.Name;
                    CLUSTER = $clusterName;
                    VMHOST = $vmhostName;
                    NUM_CPU_SOCKETS = $sockets;
                    NUM_CPU_CORES_PER_SOCKET = $coresPerSocket;
                    FOUNDATION_LICENSE_CORE_COUNT = $vsphereLicenseCount;
                    VSAN_CORE_COUNT = $coresPerSocket * $sockets;
                    VSAN_LICENSE_CORE_COUNT = $vsanLicenseCount;
                }

     

     

    But for multiple vcenter connection it only shows the last vcenter in my connected list.

    Can anybody help with my problem?

     

    Thank you in advance

    Susie

     

     

     



  • 2.  RE: FoundationCoreAndTiBUsage Script with vCenter in return

    Posted Jan 23, 2024 04:38 PM
    Cool stuffs


  • 3.  RE: FoundationCoreAndTiBUsage Script with vCenter in return

    Posted Jan 23, 2024 08:23 PM

    Assuming you did that change in the BuildFoundationUsage function, try with

       VCENTER = ([uri]$cluster.ExtensionData.Client.ServiceUrl).Host


  • 4.  RE: FoundationCoreAndTiBUsage Script with vCenter in return
    Best Answer

    Posted Jan 24, 2024 07:49 AM

    Hi LucD,

    thanks for your answer and your hint. They way you wrote it didn't work but I figured it out

     

    VCENTER = ([System.uri](get-cluster $clustername).ExtensionData.Client.ServiceUrl).Host;

     

    I don't know why it didn't work your way, because of my understanding that's almost the same 

    cheers

    Susie



  • 5.  RE: FoundationCoreAndTiBUsage Script with vCenter in return

    Posted Jan 24, 2024 07:53 AM

    Most probably because the $cluster variable didn't contain the cluster object.
    The error message should give a hint