VMware Cloud Community
vcpguy
Expert
Expert

How to get the Number of Socket Information

Hi, I am trying to get the number of sockets and cores per socket information from Powershell. I am using the get-vmhost cmdlet. If, I pipe the output to the get-member cmdlet, I dont see any option wherein I can specify the sockets.
Can any one please tell me how to get this information.

Thanks

----------------------------------------------------------------------------- Please don't forget to reward Points for helpful hints; answers; suggestions. My blog: http://vmwaredevotee.com
Reply
0 Kudos
6 Replies
a_p_
Leadership
Leadership

Maybe http://communities.vmware.com/thread/261745 will help you to build the script you need.

André

Reply
0 Kudos
LucD
Leadership
Leadership

That info is hidden in the HostSystem object, which you reach through the ExtensionData property

Get-VMHost | Select Name,@{N="Cores/CPU";E={$_.Extensiondata.Summary.Hardware.NumCpuCores/$_.Extensiondata.Summary.Hardware.NumCpuPkgs}}


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

Reply
0 Kudos
vcpguy
Expert
Expert

Can you please explain what you just did Smiley Happy I am still learning powershell and I am not that advance

----------------------------------------------------------------------------- Please don't forget to reward Points for helpful hints; answers; suggestions. My blog: http://vmwaredevotee.com
Reply
0 Kudos
LucD
Leadership
Leadership

The Get-VMHost cmdlet retrieves each ESX(i) server from the vCenter to which you are connected.

That object is passed though the pipeline to the Select-Object cmdlet, which allows us to extract specific properties from the object.

In this case the information you want to retrieve is not directly available in the .Net object returned by Get-VMHost.

But it is available in the server-side HostSystem object.

Through the ExtensionData property we have access to that HostSystem object.

Finally it a matter of dividing the total number of cores by the number of processor blocks.

That is done in a so-called calculated property (the @{N="...";E={}} construct, where N stands for Name and E for Expression) on the Select-Object cmdlet.

I hope this makes it a bit clearer.


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

Reply
0 Kudos
vcpguy
Expert
Expert

Thanks for the explanation. Can you please tell me where can I find more information about this.

Thanks

----------------------------------------------------------------------------- Please don't forget to reward Points for helpful hints; answers; suggestions. My blog: http://vmwaredevotee.com
Reply
0 Kudos
LucD
Leadership
Leadership

Have a look at the My PS Library post on my blog, it contains a number of pointers to learning resources.

The recent thread called How to get started?, contains a number of other resources with valuable links


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

Reply
0 Kudos