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
Have a look at Re: powercli command to add cpu cores to the cpu?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
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!
Have a look at Re: powercli command to add cpu cores to the cpu?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
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
Luc may not want to self promote, but I will promote him:
His book is awesome, and belong on evry VMware scripter's shelf.