Ok, it fails to execute because the host is stuck at maintenance mode. ( i'm guessing)
PS C:\temp> .\VM-HW-fix.ps1
Exception calling "ReconfigVM" with "1" argument(s): "The operation is not allowed in the current state of the host."
At C:\temp\VM-HW-fix.ps1:15 char:1
+ $VMview.ReconfigVM($VMSpec)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : VimException
Type Value
---- -----
Task task-10714132
Exception calling "ReconfigVM" with "1" argument(s): "The operation is not allowed in the current state of the host."
At C:\temp\VM-HW-fix.ps1:15 char:1
+ $VMview.ReconfigVM($VMSpec)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : VimException
Task task-10714134