1

I need to automate some tests that each time the number of CPUs and memory size of the Virtual Machine is changed. I'm wondering how to change them from command line? It seems starting and stopping guest os can be done from ESXi host's command line. But is there a command to change the virtual machine's #CPUs and memory size? Or in general, can this be done in a command line manner?

2 Answers 2

1

The easiest way to do this would be through PowerCLI, which is a PowerShell plugin for vSphere. With that you can use the Set-VMResesourceConfiguration cmdlet to modify the resource configuration of your guest machines.

3
  • Thank you DKNUCKLES! Is there a similar utility for the Linux system? The environment I have is Linux, it'll be a lot easier if I can launch something directly from current box.
    – duyt
    Sep 14, 2012 at 16:42
  • You can install a virtual appliance from Double Cloud. Can't vouch for this as I have no experience, but the link is here - doublecloud.org/2010/05/…
    – DKNUCKLES
    Sep 14, 2012 at 17:03
  • 1
    vCLI is probably what you are looking for if you want to stay in the Linux world: vmware.com/support/developer/vcli Sep 14, 2012 at 19:51
4

DKNUCKLES was correct with PowerCLI, but the actual command to do what you need is Set-VM

Usage:

$vm = Get-VM "My VM"
$vm | Stop-VM # Or use Shutdown-VMGuest to have the Guest OS do a clean shutdown
$vm | Set-VM -NumCPU 4 -MemoryMB 4096
$vm | Start-VM

Set-VMResourceConfiguration changes the resource reservations for the VM.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .