When selecting the virtual machine <vm_name.vmx> file, the "REGISTER VM" option is greyed out.
Even if the virtual machine is registered using command line, the virtual machine appears as invalid in inventory.
/var/run/log/hostd.log on ESXi host has below messages:
DictionaryParseReadLine: syntax error with line, "<XXXXX> = <not printed>". Unable to load configuration file '/vmfs/volumes/<datastore UUID>/<vm_name>/<vm_name.vmx>'. File "/vmfs/volumes/<datastore UUID>/<vm_name>/<vm_name.vmx>" line <line number>: Syntax error.
Issue usually occurs when there's problem with virtual machine configuration file <vm_name.vmx> and the file is rebuilt following Recreating a lost or deleted vmx file.
Cause
There are invalid options in virtual machine configuration file <vm_name.vmx>.
Resolution
The invalid line in virtual machine configuration file <vm_name.vmx> needs to be commented out:
Connect to the ESXi host via ssh
Locate the <vm_name.vmx> file and look for the line as mentioned in above logs with invalid values
Comment out the invalid line
Another attempt to re-register virtual machine can be made after removing the invalid line to see if the virtual machine can be successfully registered and powered on.