Hi,
We may use Get-SCOMMaintenanceMode -history to get the full MM history to see if the server entered MM multiple times.
For the workable script, we may check this:
https://www.powershellbros.com/scom-maintenance-mode-history/
Note: this is not from MS, just for your reference.
Hope the above information helps.
Regards,
Alex Zhu