when you say VMID what do you mean? If you mean the PID of the process running the VM on ESX, than this is correct ... but you shouldn't program against the PID of a process in ESX.
Scripting should be done with the vSphere API, and you would be programming against the Managed Object Reference (MoRef). This ID should be relatively static for the life of the VM, and only changes if the VM is unregistered from inventory.
Best Regards,
Jon Hemming