2012-02-16 110 views
3

主持人:Windows 7的親64位通過VMware Workstation 7.1多個問題vmrun.exe

我所試圖實現自動化:

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 

的基本理念是能夠部署不同的版本將其構建到具有受控操作系統映像和配置的虛擬機中。

我的批處理文件看起來像:

 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)start命令確實啓動了虛擬機,但從未返回到我的批處理文件中的下一行。我等了30多分鐘才確定。 2)copyFileFromHostToGuest不復制文件,從不返回或顯示任何錯誤。它只是坐在那裏。我試圖複製的文件是30KB,我等了15分鐘左右。

回答

1

看起來您的問題可能是啓動命令在整個虛擬機開啓時處於活動狀態。你有沒有嘗試在一個單獨的批處理文件中調用它?

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% 
+0

我今天試了一下,沒有幫助。我甚至嘗試手動啓動虛擬機,然後運行copyFileFromHostToGuest命令,但它仍然卡住。我瀏覽了在臨時目錄中創建的日誌,但他們什麼都沒有。我放棄了這種方法,所以相反,我的批處理文件在克隆/啓動後在VM上安裝了一個共享目錄,然後使用WMI +批處理文件完成其餘部分。但感謝您的幫助。 – 2012-03-16 00:51:51

0

您是否在32位Windows作爲主機操作系統的計算機上試過它? 我有同樣的問題,打開一個支持案例和大量的錯誤搜索後,它發現是一個問題與熊貓防病毒64位窗口阻止VMRun。所以我必須改變防病毒或使用32位Windows。

+0

對不起,實際上我有點放棄了,而是轉移到了VirtualBox,這讓我可以做同樣的事情。 – 2013-09-18 20:33:54