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

            ?

            完!

            一本久久a久久精品综合香蕉| 久久精品国产亚洲av高清漫画 | 午夜精品久久久久久| 国产成人精品久久| 国产精品99精品久久免费| 久久亚洲精品国产精品| 一本色道久久HEZYO无码| 久久天天婷婷五月俺也去| 久久久久九九精品影院| 天堂无码久久综合东京热| 伊人久久大香线蕉AV一区二区| 久久天天日天天操综合伊人av| 久久亚洲2019中文字幕| 美女久久久久久| 亚洲中文字幕无码久久2020| 色综合久久久久综合体桃花网| 久久久久久午夜成人影院| 国产精品久久久久久久久鸭| 99国内精品久久久久久久| 亚洲国产一成久久精品国产成人综合 | 久久久久久无码国产精品中文字幕 | 无码八A片人妻少妇久久| 99久久国产精品免费一区二区 | 久久精品国产欧美日韩99热| 久久久久国产精品人妻| 国内精品伊人久久久久av一坑| 久久综合欧美成人| 久久综合色区| 久久Av无码精品人妻系列| 久久精品国产精品亚洲| 婷婷伊人久久大香线蕉AV| 久久99精品久久久久久噜噜| 亚洲综合伊人久久大杳蕉| 精品久久国产一区二区三区香蕉| 婷婷久久精品国产| 国产精品99久久精品| 久久天天躁夜夜躁狠狠| 88久久精品无码一区二区毛片 | 亚洲va久久久噜噜噜久久男同| 青青青青久久精品国产| 久久久久久久精品妇女99|