I'm trying to write a quick Powershell script to change the following DRS Advanced option:
MinPoweredOnCpuCapacity
Basically, the idea is to set it high during work hours, and bump it down during off hours.
I've gotten this far, and feel I'm really close:
connect-viserver
$view = ( Get-View (Get-Cluster Cluster1).Id)
I can see the option I've already set here:
$view.Configuration.DrsConfig.Option
Key Value DynamicType DynamicProperty
--- -
-
-
MinPoweredOnCpuCapacity 90000
Here is how I've tried ot set it:
$opt = New-Object VMWAre.vim.OptionValue
$opt.Key = "MinPoweredOnCpuCapacity"
$opt.Value = 1
$spec = New-Object VMware.VIm.ClusterConfigSpecEx
$spec.DrsConfig = New-Object Vmware.vim.ClusterDrsConfigInfo
$spec.DrsConfig.option = $opt
$view.ReconfigureComputeResource($spec, $true)
This last command fails with the following message:
Exception calling "ReconfigureComputeResource" with "2" argument(s): "A specified parameter was not correct.
DRS advanced option: MinPoweredOnCpuCapacity"
At line:1 char:33
+ $view.ReconfigureComputeResource <<<< ($spec, $true)
+ CategoryInfo : NotSpecified: (:smileyhappy: [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Any ideas on how to do this??
Thanks!