Unregister invalid VMs using ESXi command-line

https://kb.vmware.com/s/article/2012964

[root@localhost:~] vim-cmd vmsvc/getallvms | grep invalid
Skipping invalid VM '18'
[root@localhost:~] vim-cmd vmsvc/getallvms
Skipping invalid VM '18'
Vmid            Name                                              File                                          Guest OS          Version                                                   Annotation                                       
32     test              [datastore_1] test/test.vmx                          ubuntu64Guest           vmx-13
[root@localhost:~] vim-cmd /vmsvc/unregister 18