10 Replies Latest reply on May 1, 2018 7:47 PM by bernz

    Script to count host build numbers

    Hetfield84 Lurker

      Hi,

       

      Our environment has a mixture of hosts on different build numbers. I'm trying to write a script that will show a count of how many hosts are running each build number. That way I can export it to Excel and make a pie graph to show the spread of versions.

       

      Using the ImportExcel module, I can create a pie graph but it counts every single result as a new value to graph

       

      This code "PieChart -title "Test" (Get-VMHost | Select Version, Build)" generates a graph like below

       

       

      If I could spit out counts like in the table below, I'd be able to create a Pie Chart like this:

        

      ESXi BuildCount
      6.0.0-460094410
      6.0.0-50505933
      6.0.0-52249345
      6.0.0-55726564
      6.0.0-67650622
      6.0.0-69213843
      6.0.0-750463764

       

      Thoughts?