VMware Cloud Community
Pegasjus
Contributor
Contributor
Jump to solution

vmware guests CPU and CPU cores

Hi,

I am looking around a bit and I know that for the physical esx hosts you can get information about the cpu and cores.

When I check the same for vmware guests I get only the cpu info. For licensinng auditing needs and so on it would be useful if this info could be split out like the following:

Get-VM | Select Name, NumvCPUs

Does anybody have a suggestion?

//Pegasjus

Tags (4)
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try this

Get-VM | Select Name,
 
@{N="CPU Sockets";E={$_.ExtensionData.Config.Hardware.NumCPU}},
 
@{N="Cores per Socket";E={$_.ExtensionData.Config.Hardware.NumCoresPerSocket}}
 


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

View solution in original post

Reply
0 Kudos
8 Replies
LucD
Leadership
Leadership
Jump to solution

Try this

Get-VM | Select Name,
 
@{N="CPU Sockets";E={$_.ExtensionData.Config.Hardware.NumCPU}},
 
@{N="Cores per Socket";E={$_.ExtensionData.Config.Hardware.NumCoresPerSocket}}
 


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

Reply
0 Kudos
Dragonfly26
Contributor
Contributor
Jump to solution

grrr...

Luc you beat me to it Smiley Happy

Reply
0 Kudos
Pegasjus
Contributor
Contributor
Jump to solution

Hey Luc,

thanks a lot, fast as always!

//Pegasjus

P.S. Cool deep dive presentation in Barcelona (even if I missed some parts) Smiley Happy

Reply
0 Kudos
kay07949
Contributor
Contributor
Jump to solution

Hi,

What types of codes are they?

.ExtensionData.Config.Hardware.NumCoresPerSocket

I can't seem to find it when I do get-member?

How can I learn more about these codes?

are they .net framework codes?

Also just to let every one know, it doesn't give you the virtual sockets, instead it gives you the total Cpu sockets, however cores per socket (s) * virtual sockets (v) = total chores per socket (t), therefore t/s=v. you can do this on excel and drag it down and it will give you the virtual sockets.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

The ExtensionData property gives you access to the vSphere object itself, not the read-only .Net object.

In this case the ExtensionData property maps to the VirtualMachine object.


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

Reply
0 Kudos
Pegasjus
Contributor
Contributor
Jump to solution

Just to add to it, I tried to get the information about which cluster the guests are in but adding @{N="Cluster";E={$Cluster.Name}}, does not help, any ideas?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-VM | Select Name,

    @{N="Cluster";E={Get-Cluster -VM $_ | Select -ExpandProperty Name}},

  @{N="CPU Sockets";E={$_.ExtensionData.Config.Hardware.NumCPU}},

  @{N="Cores per Socket";E={$_.ExtensionData.Config.Hardware.NumCoresPerSocket}}

It's not the fastest method, but it should work.


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

Reply
0 Kudos
Pegasjus
Contributor
Contributor
Jump to solution

Hey Luc,

works a charm, as for pace beats manual entry Smiley Wink

Thanks.

//Martin

Reply
0 Kudos