主机:Windows 7专业版64位与VMWare工作站7.1
我正在尝试自动化:
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
基本思想是能够将不同版本的构build版本部署到具有受控操作系统映像和configuration的虚拟机中。
我的batch file看起来像这样:
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%
克隆工作得很好。 我的问题是:1)启动命令确实启动虚拟机,但永远不会返回到我的batch file中的下一行。 我等了30多分钟才确定。 2)copyFileFromHostToGuest不复制文件,从不返回或显示任何错误。 它只是坐在那里。 我试图复制的文件是30KB,我等了15分钟左右。
看起来你的问题可能是启动命令在VM开启的整个过程中都是活动的。 你有没有尝试在一个单独的批处理文件中调用它?
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%
你有32位Windows作为主机操作系统的计算机上试过吗? 我有同样的问题,在打开一个支持案例和大量的错误搜索后,事实证明是在64位窗口阻止VMRun熊猫防病毒问题。 所以我要么改变防病毒或使用32位Windows。