VMware Cloud Community
pmaciol
Contributor
Contributor
Jump to solution

Need help using PowerCLI to report on VM configurations

Hi Guys,

I am trying to pull VM configuration details out of vCenter and am not having much luck with multicore vCPU machines.

When looking at lists of Virtual Machines within vSphere Client, it offers a basic "CPU Count" column and does not provide any further granularity (i.e. in terms of sockets & cores as opposed to just "CPU Count").

I thought perhaps I may have more luck using PowerCLI and for the most part, the "Get-VM" cmdlet has the type of information I am looking for, however I find it is somewhat lacking when it comes to vCPU details.  Essentially it turns out not to be much better than the Virtual Machine list in vSphere Client as it only produces a "Num CPUs" value, which isn't particularly useful.

For example, if "Num CPUs" is 4, what does "4" mean?  It could mean any one of the following:

  • 1 x 4 core
  • 2 x 2 core
  • 4 x 1 core

I am hoping someone out there can assist with me producing a list of VMs with configuration details that includes both sockets & cores for vCPU?

Thanks in advance!

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-VM | 
Select Name,
@
{N="CPU";E={$_.ExtensionData.Config.hardware.numCPU/$_.ExtensionData.Config.hardware.numCoresPerSocket}},
@{N="Core per CPU";E={$_.ExtensionData.Config.hardware.numCoresPerSocket}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

3 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-VM | 
Select Name,
@
{N="CPU";E={$_.ExtensionData.Config.hardware.numCPU/$_.ExtensionData.Config.hardware.numCoresPerSocket}},
@{N="Core per CPU";E={$_.ExtensionData.Config.hardware.numCoresPerSocket}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

pmaciol
Contributor
Contributor
Jump to solution

Thank you so much, that is exactly what I was looking for Smiley Happy

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I just updated the CPU property, that one was not correct


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference