Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 163229

Re: VM Allocation and Consumption Report

$
0
0

I am not sure how you use the folders per cluster. Afaik you can't create a folder in the 'Hosts and Clusters' view below a cluster. The following script will give you the requested information without the folders. If you elaborate on the folders maybe I can add them later.

 

Get-Datacenter |

Sort-Object -Property Name |

ForEach-Object {

  $Datacenter = $_

  foreach ($Cluster in (Get-Cluster -Location $Datacenter | Sort-Object -Property Name))

  {

    $VMs = Get-VM -Location $Cluster

    New-Object -TypeName PSObject -Property @{

      Datacenter = $Datacenter.Name

      Cluster = $Cluster.Name

      'No. of Virtual Machines' = $VMs | Measure-Object | Select-Object -ExpandProperty Count

      'Allocated CPU' = $VMs | Measure-Object -Property NumCpu -Sum | Select-Object -ExpandProperty Sum

      'Allocated memory (GB)' = $VMs | Measure-Object -Property MemoryGB -Sum | Select-Object -ExpandProperty Sum

      'Disk Provisoned (GB)' = $VMs | Measure-Object -Property ProvisionedSpaceGB -Sum | Select-Object -ExpandProperty Sum

    } | Select-Object -Property Datacenter,Cluster,'No. of Virtual Machines',

          'Allocated CPU','Allocated memory (GB)','Disk Provisoned (GB)'

  }

}

 



Viewing all articles
Browse latest Browse all 163229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>