• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            S.l.e!ep.¢%

            像打了激速一樣,以四倍的速度運轉,開心的工作
            簡單、開放、平等的公司文化;尊重個性、自由與個人價值;
            posts - 1098, comments - 335, trackbacks - 0, articles - 1
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            API控制VM虛擬機(VM Workstation or VM Server)

            Posted on 2010-03-02 12:54 S.l.e!ep.¢% 閱讀(1047) 評論(0)  編輯 收藏 引用 所屬分類: test

            API控制VM虛擬機(VM Workstation or VM Server)

            作者:iTech??來源:博客園??發布時間:2009-12-03 13:55??閱讀:326 次??原文鏈接?? [收藏]??
            <!--[endif]-->

            Controlling VM by Script

            1 VMRun

            VMRun is a command line tool which is delivered with VM workstation or VM server. the tool have many sub commands to control VM, such as starting and stopping VM, creating and reverting to snapshot, run programs or scripts in VM, setting shared folder and setting environment variables in VM, creating and deleting folder and file in VM, checking and killing process in VM, taking record and capturing screen.

            ?

            Of course you also can find other language wrapper for VMRun, such as VMRun-Python.

            ?

            2 VIX API

            The VIX API allows you to do the same things with VMRun, and you needn't install VM workstation or VM server, just need install VIX SDK. The VIX API allows you to automate virtual machine operations on VMware Server or VMware Workstation.

            The VIX API can be accessed by C, Perl and COM.

            ?

            3 VMRun command usage

            Vmrun /?

            ?

            4 examples

            @echo off

            ?

            echo setting the path of vmrun.exe into the system path.

            rem set path="C:\Program Files\VMware\VMware Workstation";%path%

            set path="C:\Program Files\VMware\VMware VIX";%path%

            ?

            set vmImage="D:\VMRun\VMrun_Test\Windows XP Professional.vmx"

            set vmtype=ws

            ?

            set guestuser=AAA

            set guestpassword=AAA

            ?

            set snapshotname=snapshot1

            ?

            set hostsharedfolder=d:\share

            set guestnewfolder=c:\share

            ?

            echo revert to snapshot

            vmrun -t %vmtype% revertToSnapshot %vmimage% %snapshotname%

            ?

            echo start vm without gui

            vmrun -t %vmtype% -gu %guestuser% -gp %guestpassword% start %vmImage% nogui

            ?

            echo run notpad.exe in vm

            rem vmrun -t %vmtype% -gu %guestuser% -gp %guestpassword% runprograminguest %vmimage% -activeWindow "c:\windows\system32\notepad.exe"

            ?

            echo set the host shared folder %hostsharedfolder% for accessing in VM, you can access the shared folder by \\.host\****

            vmrun -t %vmtype% -gu %guestuser% -gp %guestpassword% addSharedFolder %vmimage% hostsharedfolder %hostsharedfolder%

            ?

            echo create one new folder in VM

            vmrun -t %vmtype% -gu %guestuser% -gp %guestpassword% createDirectoryInGuest %vmimage% %guestnewfolder%

            ?

            echo copy files from the host to VM

            vmrun -t %vmtype% -gu %guestuser% -gp %guestpassword% copyFileFromHostToGuest %vmimage% %hostsharedfolder%\* %guestnewfolder%

            ?

            echo check whether the file is exist in VM

            vmrun -t %vmtype% -gu %guestuser% -gp %guestpassword% fileExistsInGuest %vmimage% %guestnewfolder%\test.bat

            ?

            echo run script in VM

            vmrun -t %vmtype% -gu %guestuser% -gp %guestpassword% runProgramInGuest %vmimage% %guestnewfolder%\test.bat

            ?

            echo copy files from VM to the host

            vmrun -t %vmtype% -gu %guestuser% -gp %guestpassword% copyFileFromguestTohost %vmimage% %guestnewfolder%\test2.txt %hostsharedfolder%

            ?

            echo capture VM screen

            vmrun -t %vmtype% -gu %guestuser% -gp %guestpassword% captureScreen %vmimage% %hostsharedfolder%\resultscreen.png

            ?

            5 一般地,我們可以通過API來控制VM,實現軟件測試的全自動化。


            6 reference

            使用runprograminVM來在VM中自動安裝軟件時注意:http://communities.vmware.com/blogs/vmroyale/2009/04/23/using-vmrun-runprograminguest-with-windows-installer-msi-packages

            Using vmrun runProgramInGuest with Windows Installer (MSI) packages

            ?

            完!

            精品人妻伦九区久久AAA片69| 人妻少妇久久中文字幕一区二区| 国产精品嫩草影院久久| 99久久777色| 激情久久久久久久久久| 久久精品国产亚洲AV不卡| 久久精品一区二区| 亚洲一级Av无码毛片久久精品| 亚洲午夜久久久影院伊人| 国产福利电影一区二区三区久久老子无码午夜伦不 | 久久久久久青草大香综合精品| 久久人人爽人人爽人人片AV不 | 久久精品国产亚洲AV蜜臀色欲| 久久ZYZ资源站无码中文动漫| AA级片免费看视频久久| 天堂久久天堂AV色综合| 国产一区二区三精品久久久无广告 | 久久中文字幕无码专区| 999久久久免费精品国产| 久久精品国产日本波多野结衣| 久久精品这里热有精品| 亚洲αv久久久噜噜噜噜噜| 久久精品国产亚洲5555| 亚洲精品国产成人99久久| 久久国产劲爆AV内射—百度| 久久精品免费全国观看国产| 91精品观看91久久久久久 | 日韩人妻无码精品久久免费一| 久久露脸国产精品| 久久99久久成人免费播放| 久久99国产精一区二区三区| 国产精品久久久久无码av| 97久久久久人妻精品专区| 国产精品久久一区二区三区| 久久精品国产亚洲AV无码麻豆 | 一本色道久久88加勒比—综合| AV狠狠色丁香婷婷综合久久| 人妻无码久久一区二区三区免费 | 国内精品久久久久影院老司 | 亚洲国产成人精品91久久久 | 国产精品久久久久久福利漫画|