• <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.¢% 閱讀(1043) 評論(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

            ?

            完!

            四虎国产精品免费久久久 | 久久99精品综合国产首页| 日韩人妻无码一区二区三区久久| 嫩草伊人久久精品少妇AV| 久久青青草原综合伊人| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 国产成人精品久久一区二区三区| 99久久www免费人成精品| 久久久久亚洲国产| 91精品久久久久久无码| 午夜精品久久久久久中宇| 国产69精品久久久久99尤物| 久久AV高潮AV无码AV| 久久综合狠狠综合久久激情 | 久久亚洲精品成人无码网站| 青青青青久久精品国产h| 欧美精品久久久久久久自慰| 人人狠狠综合久久亚洲| 国产精久久一区二区三区| 国产V亚洲V天堂无码久久久| 久久久亚洲裙底偷窥综合 | 一本大道久久东京热无码AV| 久久精品国产影库免费看| 一本一道久久综合狠狠老| 久久经典免费视频| 少妇久久久久久被弄到高潮| 国内精品伊人久久久久影院对白| 久久99热只有频精品8| 久久人做人爽一区二区三区| 亚洲&#228;v永久无码精品天堂久久| 国产欧美久久久精品| 久久国产免费观看精品3| 18岁日韩内射颜射午夜久久成人 | 久久亚洲春色中文字幕久久久| 久久久一本精品99久久精品88| 久久午夜免费视频| 99精品国产99久久久久久97| 久久久亚洲欧洲日产国码aⅴ| 国内精品久久久久久久97牛牛| 人妻无码中文久久久久专区 | 无码人妻久久一区二区三区蜜桃|