Quantcast
Viewing all articles
Browse latest Browse all 232869

Re: reconfiguring RAM and CPU of VM machines

Try something like this

 

Import-Csvc:\vms.csv-UseCulture|%{    $vm=Get-VM-Name$_.VMName
   
Shutdown-VMGuest-VM$vm-Confirm:$false
    while($vm.PowerState-ne"PoweredOff"){        sleep5
        $vm=Get-VM-Name$_.VMName
    }   
Set-VM-VM$vm-MemoryGB$_.MemoryGB-NumCpu$_.NumCpu
   
Start-VM-VM$vm-Confirm:$false
}

 

The CSV looks like this

"VMName","MemoryGB","NumCpu"

"VM1","8","2"

"VM2","4","1"

This script will do the stop-changes-start sequence 1 VM at a time.

You can do this in parallel, but that will require the script to keep track of each of the background tasks before starting the next step

 

Note: the script assumes that the VMware Tools are installed on the VMs.


Viewing all articles
Browse latest Browse all 232869

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>