VMware Cloud Community
alansinclair
Contributor
Contributor
Jump to solution

configuring CPU and NICs

I'm creating a VM, installing Linux then shutting it down. Using PowerCLI how can I configure the CPU to have two cores per socket (either when creating the VM or after shut-down - either is fine)?

I also have to delete the NIC used for set-up and create two new NICS. If I leave the MAC addresses blank, will ESXi auto-generate the MAC address when the VM is first used?  (The VM will be exported and used on different machines.)

Thanks

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

On the New-VM cmdlet you can use the NumCpu parameter to specify the number of vCPU.

For an existing VM, you can use the Set-VM cmdlet.

For the NICs you can use the Remove-NetworkAdapter and New-NetworkAdapter cmdlets.

ESXi will generate the MAC, but afaik that is done at the moment you assign the NIC.


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

alansinclair
Contributor
Contributor
Jump to solution

The problem is that my VM is supposed to provide two "cores per socket" and one "virtual socket", which can be specified in the vSphere client.

The -NumCpu parameter has only one argument, so it isn't quite a flexible as the GUI.

Thanks!

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Have a look at Re: powercli command to add cpu cores to the cpu?


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

0 Kudos
alansinclair
Contributor
Contributor
Jump to solution

Thanks yet again Luc for the spot-on answer!

LucD wrote:

Have a look at Re: powercli command to add cpu cores to the cpu?

$spec=New-Object –Type VMware.Vim.VirtualMAchineConfigSpec –Property @{“NumCoresPerSocket” = 1}

(Get-VM –Name Test_VM).ExtensionData.ReconfigVM_Task($spec)

What should I be reading to learn more about SDK methods and PowerCLI scripting?  I seem to be permanently groping in the dark then coming here for rescue.

Alan

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I could mention the PowerCLI Reference that contains a chapter on using the SDK methods and properties, but that would look like self-promotion :smileygrin:

There is also Steve Jin's SDK book. It's written for VIJava, but it explains how to work with the SDK.

The conversion from Java to PowerCLI is not too difficult.

You can find links to both books in my My PS Library post.


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

0 Kudos
mcowger
Immortal
Immortal
Jump to solution

Luc may not want to self promote, but I will promote him:

http://www.amazon.com/VMware-vSphere-PowerCLI-Reference-Administration/dp/0470890797/ref=sr_1_1?ie=U...

His book is awesome, and belong on evry VMware scripter's shelf.

--Matt VCDX #52 blog.cowger.us
0 Kudos