Following up on my last post on Automating DRS Groups with PowerCLI I found that we also need to automatically remove VMs and Hosts from a given DRS Group.
Although I could have included this in the previous script which creates the groups and adds members I wanted to separate them. There could for instance be times when you would like to run such a script on a different interval than the one that adds members as well as other scenarios. I believe it’s also a good practice to build smaller scripts and functions that have more specific tasks. You could argue that the creation script also could be split up into a part that creates groups and a part that adds the members, and even maybe further splitting Hosts from VMs but that would be a future task.
Anyways, the removal of entities like Hosts and VMs from a DRS group is as easy as putting them in.