Script based vmware “DRS” (Distributed Resource Scheduler)

Recently I found a very interesting script to do something like vmware DRS.

https://ryanmangansitblog.com/2013/03/08/vmware-host-cluster-vm-memory-balancing-script-implementation/

There are some points to improve and the you can use it very well.


Use it only on a certain cluster

change the line 5 from

before
$objHosts = get-vmhost; 

after
$objHosts = get-vmhost | Where-Object {$_.Parent -Like “*Clustername*”} ;

Use random VM to move
(without that, you will face the problem, that you have a lot of small VMs on one host and on the others, you’ll have the larger ones!)

Remark the line 31

# $objVMs = $objVMs | sort “Memory*”

change the percentage of the average memory load
(either set this value to 0 or use an other number that 10%)

change the value in the line 94

if($objHost.PercentMemory -gt ($intAverage + 10)){

 

 

thanks to Scott Warren and Ryan Mangan