Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiple problems with vmrun.exe

Host: Windows 7 pro 64-bit with VMWare Workstation 7.1

What I am trying to automate:

1) Clone a template into a new VM. The template is Windows Server 2003 32-bit w/SP1 and already has VMWare tools installed and network and VM settings configured the way I want.
2) Start the VM
3) Copy a batch file and a zip file into the VM which installs a build and copies some files into certain locations. The build is different each time but I want the OS to be the same each time.
4) Run the batch file within the VM

The basic idea is to be able to deploy different versions of the build into a VM with a controlled OS image and configuration.

my batch file looks something like:

     vmrun clone %vm_template_path% %new_vm_path% full
     vmrun -T ws -gu <user> -gp <pass> start %new_vm_path% gui
     vmrun -T ws -gu <user> -gp <pass> copyFileFromHostToGuest %new_vm_path% %file_on_host% %file_path_on_VM%
     vmrun -T ws -gu <user> -gp <pass> runProgramInGuest %new_vm_%path% -nowait -interactive %file_on_host%

The clone works just fine. My problem(s) are: 1) The start command does properly startup the VM, but never returns to the next line in my batch file. I waited over 30 minutes to ensure. 2) The copyFileFromHostToGuest does not copy the file, never returns or display any errors. It just sits there. The file I tried to copy as a test was 30KB and I waited 15 minutes or so.

like image 856
Shaurav Garg Avatar asked Jul 17 '26 18:07

Shaurav Garg


1 Answers

It looks like your problem could be that the start command is active the entire time the VM is turned on. Have you tried calling it in a separate batch file?

vmrun clone %vm_template_path% %new_vm_path% full

REM Creates a separate batch to run the start command which will delete itself when done
ECHO vmrun -T ws -gu <user> -gp <pass> start %new_vm_path% gui > startVM.bat
ECHO del /q /s /f startVM.bat >> startVM.bat

REM runs the separate batch
startVM.bat

REM if the VM needs to be booted before you continue with the file copy you can try a TIMEOUT in here like the two minute one below:
TIMEOUT 120

vmrun -T ws -gu <user> -gp <pass> copyFileFromHostToGuest %new_vm_path% %file_on_host% %file_path_on_VM%
vmrun -T ws -gu <user> -gp <pass> runProgramInGuest %new_vm_%path% -nowait -interactive %file_on_host%
like image 136
iesou Avatar answered Jul 21 '26 02:07

iesou