• <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

            ?

            完!

            久久婷婷人人澡人人| 久久香蕉综合色一综合色88| 久久久久亚洲AV无码专区网站| 久久久久亚洲AV成人网| 久久亚洲精品国产精品婷婷| 亚洲欧美日韩中文久久| 99久久99久久精品国产片果冻 | 亚洲熟妇无码另类久久久| 久久久精品2019免费观看| 中文字幕亚洲综合久久| 99久久精品国产一区二区| 93精91精品国产综合久久香蕉| 久久久久99这里有精品10| 久久国产成人精品麻豆| 亚洲中文字幕无码久久2020| 久久er国产精品免费观看8| 久久久久亚洲AV无码专区体验| 久久久久久久亚洲精品| 91精品国产91久久久久福利| 武侠古典久久婷婷狼人伊人| 国产高潮国产高潮久久久91 | 久久精品国产亚洲AV电影| 久久久这里有精品中文字幕| 狠狠狠色丁香婷婷综合久久五月| 午夜视频久久久久一区 | 午夜精品久久久久| 欧美亚洲国产精品久久蜜芽| 日韩av无码久久精品免费| 狠狠色丁香婷婷久久综合五月| 久久精品国产色蜜蜜麻豆| 久久国产精品一区二区| 精品久久久久久无码专区| 久久99精品国产麻豆宅宅| 久久综合久久综合亚洲| 亚洲欧洲中文日韩久久AV乱码| 久久人人爽人爽人人爽av| 久久久久噜噜噜亚洲熟女综合| 国产成人精品久久一区二区三区av | 一级做a爰片久久毛片看看| 久久精品一区二区三区不卡| 国产精品禁18久久久夂久|