VMware Communities
luiszhao
Contributor
Contributor

How can I know the vm restore completed when I use vmrun.exe

Hi All

When I used vmrun.exe to start a suspend VM, the vmrun.exe existed but the restore state is not completed. E.g. the restoring state 78% in the status bar. How can I detect the vm restore is completed?

0 Kudos
3 Replies
luiszhao
Contributor
Contributor

I am using VMware Workstation 15.5.2

0 Kudos
Mits2020
Hot Shot
Hot Shot

I did some research and it seems that what you need is not programmatically implemented, so you have to think about it a bit. Would a test to see whether the resumed guest is ready or not to accept commands suit your purposes?

I *think* that if via vmrun you e.g. ask the guest to check for the existence of a file, or provide a listing of a directory, when the guest is not ready, there will be some kind of error. On the other hand, if the guest is ready (i.e. fully resumed) the command will provide a result without error.

The example I have in mind is the following, taken from chapter "Using vmrun to Work with Guest Operating Systems Files and Directories" in http://nuclear.unh.edu/wiki/index.php?title=Using_VMWare_vmrun

To check for the existence of a particular file:

vmrun -T server -h https://hostname:8333/sdk -u root -p mypassword -gu fred -gp guestpasswd fileExistsInGuest "[Vol1] CentOS 5.2/CentOS 5.2.vmx" /home/fred/MyFile

The file exists.

The above is just a blind guess from my part, I am sure there are more elaborated ways to answer your question, depending the way you need to be informed about the status of the guest resume process. If you are working on local guests you just wait for it to resume in the GUI :), but if you are working with a remote guest there should be a way to do this in a clever and efficient way.

0 Kudos
continuum
Immortal
Immortal

Now you do basically

vmrun start PATH

You assume that when vmrun exits it  means "VM is running and happy" but what if the command exits with an error-message you dont check for ?

Cant you run

vmrun start PATH

vmrun list > log.txt

Next check wether log.txt has PATH

If yes - VM is running and happy

If no - VM is not running

If the Status-bar is showing something that contradicts your vmrun list check - I would assume that the Status-bar is not up to date ...


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos