That was it... thanks for your help!
The code provided doesn't throw any error. However when I double check the vmx file the result is not applied and the previous value persist.
I have copy/paste your code, and to verify the value of "$dev.Device.UptCompatibilityEnabled" I collect it before and after the config is applied.
I have also check in the vmx file and the value for the UptCompatibilityEnabled persist.
The line $vm.ExtensionData.ReconfigVM($spec) looks to not apply the config to the vmx file.
Is anyone else who notice that behavior ?
I am on ESXi 6.5 U2
The settings in the VMX are not updated immediately.
Was the VM powered off when you ran the script?