Hi Guys,
So here is the scenario. In our company we have a lot of big Clusters. So when we put a Host to maintenance mode, it takes a while to do the job. However, sometimes things dont go as planned. Sometimes, the host never goes into maintenance mode because of a configuration in a single VM. Therefore we needed a way to identify when a host is taking too long to come to maintenance mode.
Now i was given the task to automate the ESXI host patching. And i was given instructions to come up with a way to cancel maintenance mode if its taking too long. but so far, i couldn't find a way to monitor the below command and cancel maintenance mode if the timer exceeds. Do you guys know a better way?
Set-VMHost $VMhost -State Maintenance -Confirm:$false -ErrorAction Inquire
I have heard that we can use the "Maintenancemodetask()" function. but i have no idea how to use that. even if it works for my needs..!!!