We’ve spoken about Resource Pools a couple of times over the last months and specifically about shares. (The Resource Pool Priority-Pie Paradox, Resource Pools and Shares.) The common question I received was how can we solve this. The solution is simple: Custom Shares.
However, the operational overhead associated with custom shares is something most people want to avoid. Luckily for those who have the requirement to use share based resource pools one my colleague Andrew Mitchell shared a powershell script. This powershell script defines custom shares based on a pre-defined weight and the amount of VMs / vCPUs in the resource pool. I would recommend to schedule the script to run on a weekly basis and ensure the correct amount of shares have been set to avoid running into one of the scenarios described in the articles above.
Please keep in mind that if you use nested resource pools you will need to run a separate script for each level in the hierarchy.
Eg. If the resource pools are setup like this the following you will need one script to set the shares for RP1, RP2 and RP3, and another script to set the shares for RP1-Child1 and RP1-Child2.
Download the script here. Again to emphasize it I am not the author, we would appreciate it though if you could share any modifications / enhancements to this script.