Good afternoon,
I want to make a PowerCLI script that allow me to increase/decrease vCPUS:
1) Stopping VM.
2) Increase or decrease vCPUs.
3) Starting VM.
Can you help me in this script?
Thank you in advance.
Best regards.
-----
VMware Certified Professional VCP3 and VCP4.
If you find this or any other information helpful or correct, please consider awarding points.
Since I'm not sure if you want to create a function for this I provided a sample script to increase the vCPU number by 1.
$vm = Get-VM <VM-name> $vm | Stop-VM -Confirm:$false $vm | Set-VM -NumCpu ($vm.NumCpu + 1) -Confirm:$false $vm | Start-VM -Confirm:$false
Perhaps there should also be some logic to test if the total number of vCPU is correct (1,2,3 or 4)
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Since I'm not sure if you want to create a function for this I provided a sample script to increase the vCPU number by 1.
$vm = Get-VM <VM-name> $vm | Stop-VM -Confirm:$false $vm | Set-VM -NumCpu ($vm.NumCpu + 1) -Confirm:$false $vm | Start-VM -Confirm:$false
Perhaps there should also be some logic to test if the total number of vCPU is correct (1,2,3 or 4)
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you LucD. I just reading another post writed for you:
http://communities.vmware.com/message/1339759#1339759
Thank you!
----
VMware Certified Professional VCP3 and VCP4.
If you find this or any other information helpful or correct, please consider awarding points.
Hi LucD
I have a bunch of VM which needs to be shut down & change the values of the CPU/Memory as per xls
Virtual Machine, Configured vCPU, Recommended vCPU, Configured Memory, Recommended Memory
Can you help get a script for this
my try so far is
$VMs = @("VM1","VM2","VM3")
$mem= @("mem1","mem2","mem3")
$cpu....
ForEach ($VM in $VMs) |
{
Get-VM $VM |Set-VM -StaticMemory -MemoryStartupBytes $mem
Get-VM $VM |Set-VM -NumCpu ($vm.NumCpu - $cpu) -Confirm:$false
}
I am sure uw ill have a better one
nm, i got it, as in
Need to adjust/reconfiure/tune resouces of bunch of VMs per input in xls file