Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

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.

share|improve this answer
    
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 '12 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 '12 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 –  JakeRobinson Sep 14 '12 at 19:51
add comment

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.

share|improve this answer
    
Thanks Jake, This works! –  duyt Sep 16 '12 at 1:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.