# Found 11/11/15 https://vmscribble.com/powercli/change-drs-migration-threshold/
# Thanks http://www.thelowercasew.com/powercli-script-to-change-the-drs-slider for the DRS change code.
# Add the PowerCLI snapin to PowerShell
Add-PSsnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue
# Set Variables
$vCenter = Read-Host "Enter the vCenter Name"
$listofclusters = Read-Host "Enter the path to the lists of clusters ex. c:scriptshosts.txt"
$clusName = Get-Content -path $listofclusters
# Connect to your vCenter
Connect-VIServer $vCenter
# Change DRS Slider
# The script reads the slide right to left instead of left to right
# 4 in this script is really 2 in vCenter
$rate = 4
write-host "Changing DRS Migration Threshold"
$clus = Get-Cluster -Name $clusName | Get-View
$clusSpec = New-Object VMware.Vim.ClusterConfigSpecEx
$clusSpec.drsConfig = New-Object VMware.Vim.ClusterDrsConfigInfo
$clusSPec.drsConfig.vmotionRate = $rate
$clus.ReconfigureComputeResource_Task($clusSpec, $true)
# Disconnect from the vCenter
Disconnect-VIServer $vCenter -Confirm:$false