I have one function to add vms in DRS group. Is possible remove 1,2,3 etc vms from DRS group with powercli?
You might want to look at the Set-DrsVmGroup cmdlet in out DRSRule module.
See DRSRule – a DRS rules and groups module
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Tks your reply.
But dont find option to remove one or two vms. Only find option -Append vm
Yes, It should be possible. Sometime back I had written a blog on editing VM-VM affinity rule (Java SDK). : http://vthinkbeyondvm.com/how-to-edit-drs-vm-vm-affinity-rules-using-vsphere-api-bit-tricky-solution...
I will give a try to achieve your requirement in PowerCLI.
The cmdlet does accept one or more VM.
With the Append switch ($true or $false) you define if these VMs are appended to or replacing the VMs already in the group
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD- I've been digging around and am looking for the same solution as the OP. I have an existing DRS rule (VM's to Host's) in my cluster with about 150 VM's in the VM DRS group - I'd like to remove about 60 VM's from this group. It doesn't appears that this cmdelt will perform that task. Am I missing something? Thanks in advance!
You should be able to retrieve the current VM group with the Get-DrsVmGroup cmdlet.
Then you remove the 60 you doin't want in there, and use a Set-DrsVmGroup to set the updated VM group
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
For other people who may have the same question.
Yes, it is possible using the module suggested by @LucD https://github.com/PowerCLIGoodies/DRSRule/blob/master/README.md
with the Set-DrsVMGroup command and the -RemoveVM parameter
get-help Set-DrsVMGroup -Examples
Get-DrsVMGroup -Name 'VM Group 1' -Cluster Cluster1 | Set-DrsVMGroup -RemoveVM vm[1-2]
Remove the given virtual machines from DRS VM group 'VM Group 1' on cluster 'Cluster1'
Name Cluster UserCreated VM
---- ------- ----------- --
VM Group 1 Cluster1 False {VM3,VM4}