First, sorry for warming up this old post. But I'm sure, that not few companies are still on 3.5 and may migrate to higher versions. Thats what we did recently.
I stumbled over the same problem when trying to do excactly the same as the poster did.
The solution is quite simple:
In 3.5 and 4.1 vmware-cmd's are interpreted a bit differential.
So dont use:
vmware-cmd "$vm" getstate -q
use this:
vmware-cmd -q "$vm" getstate
If you are planning to store the logfile in /tmp, be also informed about this: User-created files in the ESX /tmp directory are deleted with each host reboot