Perhaps you should mention that this will only work with cluster nodes when the DRS Automation level is set to "fully automated".
As long as there are active guests, your hosts will not enter maintenance mode.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference