Opvizor

Find Number of VCPU used in a Cluster and ESXi hosts

This Post explain how can we generate an output contains , Total number of vCpu used in an vCenter Cluster , also it shows many vCPU used per Esxi hosts .  If you have  multiple Cluster it is very easy to find same using below script.

Connect-VIServer  “vCenter Name”

$TotalNumvCPUs = 0
Foreach ($Cluster in (Get-Cluster |Sort Name)){
$HostNumvCPUs = 0
Write-Host “Cluster: $($Cluster.name)“
Foreach ($ESXHost in ($Cluster |Get-VMHost |Sort Name)){
Write-Host “ Host: $($ESXHost.name)“
$RunningLimit = $null
$RunningLimit = ($ESXHost |Get-VMHostAdvancedConfiguration).get_Item(“Misc.RunningVCpuLimit“)
If ($RunningLimit -eq $null){
$RunningLimit = 128
}
Write-Host “ Misc.RunningVCpuLimit: $RunningLimit“
Foreach ($VM in ($ESXHost |Get-VM)){
$HostNumvCPUs += ($VM).NumCpu
}
Write-Host “ Number of vCPU on host: $($HostNumvCPUs)“
$TotalNumvCPUs += $HostNumvCPUs
$HostNumvCPUs = 0
}
Write-Host “———-“
Write-Host “Number of vCPU in $($Cluster.name): $TotalNumvCPUs“
Write-Host “———-“
Write-Host “”
$TotalNumvCPUs = 0
}

Output 

 

 

Rajesh Radhakrishnan

Share
Published by
Rajesh Radhakrishnan

Recent Posts

NAKIVO Backup & Replication v10.8 Released With New Features

Nakivo has released its new Backup and Replication solution Nakivo v10.8, which includes support for…

2 years ago

Oracle Cloud VMware Solution and Features

Oracle Cloud VMware Solution (OCVS) provides a customer-managed, native VMware-based cloud environment hosted in Oracle…

2 years ago

Vinchin Backup and Recovery Review

Vinchin is a professional provider of data protection solutions for enterprises. It provides a series…

2 years ago

VMware Cloud Disaster Recovery (VCDR) Solution Deployment And Configuration Part 2

In my previous blog post, I have explained about VMware Cloud Disaster Recovery (VCDR) Onboarding and…

2 years ago

How to Deploy vRNI Cloud With VMC on AWS

vRealize Network Insight helps you build an optimized, highly available, and secure network infrastructure across…

2 years ago

This SysAdmin Day, WIN with Hornetsecurity!

Can you believe it's here again? SysAdmin Day is back, and with it comes endless gratitude…

2 years ago