In this blog post, I will be sharing a PowerCLI/PowerShell function that we can use to setup DRS and DRS parameters for automating our cluster DRS configurations. The function allows you to enable DRS and DPM and set DRS and DPM aggression and automation levels. I have posted the PowerCLI function Set-DRS to my github repository. Feel free to test it and add comments if you come across any errors or issues when using this function.
Note: the function assumes that you are already connected to a vCenter server.
Let's take a look at few examples of the function in action.
In the first example, we will enable DRS, set automation level to fully automated and set the aggression level to 4:
In the second example, we enable cluster DPM and set automation level to Automatic and aggression level to 4:
All of these configurations can be done directly from the vCenter GUI, however, this function comes in handy when you would want to automate vSphere cluster DRS tasks.