I've run into this issue, as seen in the 5.x section of this KB article. However, after doing these steps, it still shows unknown state for many vm's. Many were fixed by migrating them to other hosts. This problem happened after the host froze/failed and needed to be rebooted. When I execute this command now:
vim-cmd vmsvc/getallvms
Then it doesn't show them anymore (it did before I did all these steps). We are running esxi 5.0 with vcenter 5.0.
Any advice?