10 Replies Latest reply on Feb 25, 2020 6:00 AM by LucD

    Need script for to get  cluster name, esxi host name and VM's count in the cluster and last core and sockets. for licensing

    466kdl1 Novice

      Hey Guys can you help my required . I was able to get the  details esxi host  cores and socket  but  cluster name and Vm's count

       

      Need script for to get  cluster name, esxi host name and VM's count in the cluster and last core and sockets. for licensing

       

      Here is the script am using.

       

      $result = @()

       

      $vmhost = get-vmhost

       

       

      foreach ($esxi in $vmhost) {

       

       

         

          $HostCPU = $esxi.ExtensionData.Summary.Hardware.NumCpuPkgs

       

       

          $HostCPUcore = $esxi.ExtensionData.Summary.Hardware.NumCpuCores/$HostCPU

       

       

          $obj = new-object psobject

       

       

          $obj | Add-Member -MemberType NoteProperty -Name name -Value $esxi.Name

       

       

          $obj | Add-Member -MemberType NoteProperty -Name CPUSocket -Value $HostCPU

       

       

          $obj | Add-Member -MemberType NoteProperty -Name Corepersocket -Value $HostCPUcore

       

       

          $result += $obj

      }

      $result | Export-Csv esxireport.csv -NoTypeInformation -UseCulture