VMware Cloud Community
DanielLeeDL
Contributor
Contributor
Jump to solution

How to defined the cores of a vCPU in VM with Set-VM cmdlet

Hi,

     i'm trying to use PowerCLI to config VM in ESXi 5, i know how to change the vCPU number of a VM using the following command: Set-VM -VM "myvm" -numCPU 2 . However, now i want to set the cores in a vCPU, and i have read the Set-VM help using : Get-Help Set-VM -Detailed , but there is nothing mentioned about that.

     is there any access for me to set the number of cores ?

Thanks Daniel.

0 Kudos
1 Solution

Accepted Solutions
mattboren
Expert
Expert
Jump to solution

Hello, DanielLeeDL-

There was just such a question yesterday about this.  You can pretty easily change the number of cores per socket using the v5 API example in that thread at:  http://communities.vmware.com/message/1891250

How does that do for you?

View solution in original post

0 Kudos
2 Replies
mattboren
Expert
Expert
Jump to solution

Hello, DanielLeeDL-

There was just such a question yesterday about this.  You can pretty easily change the number of cores per socket using the v5 API example in that thread at:  http://communities.vmware.com/message/1891250

How does that do for you?

0 Kudos
DanielLeeDL
Contributor
Contributor
Jump to solution

hi mattboren,

     that works! Thanks very much! The script below is OK in vSphere 5:

$spec = New-Object -Type VMware.Vim.VirtualMachineConfigSpec -Property @{"NumCoresPerSocket" = 2};
(Get-VM myVM).ExtensionData.ReconfigVM_Task($spec);

Daniel.

0 Kudos