Get Cluster Provisioned Resources

The script below pulls a list of your clusters with their CPU & Memory Total Capacity as well as how much has been provisioned. It then displays the ratio to physical to virtual to help you maintain your over-commitment ratios. Its setup as a function so you can choose whether to display text on screen with | FT or Export to csv with | Export-CSV

Function Name: VPF-ClusterAllocated

This is also likely to be my last post of the year so i hope those of you having time off over the christmas period get to enjoy spending some well earned time with your families

Function VPF-ClusterAllocated
{
Get-Datacenter | Get-Cluster |
Select Name, HAEnabled, DRSEnabled,
@{N=“TotalCores“;E={
    $script:totalCores = Get-VMHost -Location $_ | Measure-Object NumCpu -Sum | Select -ExpandProperty Sum
    $script:totalCores}},
@{N=“ProvisionedCores“;E={
    $script:provisionedcores = Get-VMHost -Location $_ | get-vm | Measure-Object NumCpu -Sum | Select -ExpandProperty Sum
    $script:provisionedcores}},
@{N=“CoresRatio“;E={[math]::Round($script:provisionedcores/$script:totalcores,2)}},
@{N=“TotalMem“;E={
 $script:TotalMem = Get-VMHost -Location $_ | Measure-Object MemoryTotalGB -Sum | Select -ExpandProperty Sum
 [math]::Round($script:TotalMem)}},
@{N=“ProvisionedMem“;E={
 $script:ProvisionedMem = Get-VMHost -Location $_ | get-vm | Measure-Object MemoryGB -Sum | Select -ExpandProperty Sum
 $script:ProvisionedMem}},
@{N=“MemRatio“;E={[math]::Round($script:ProvisionedMem/$script:TotalMem,2)}}
}

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.