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

            ?

            完!

            99久久精品费精品国产| 亚洲精品高清国产一线久久| 狠狠色综合网站久久久久久久高清| 久久亚洲高清综合| 国产精品久久久久a影院| 日韩精品无码久久久久久| 久久99国产精品久久久| 欧美伊人久久大香线蕉综合69| 77777亚洲午夜久久多人| 97精品久久天干天天天按摩 | 久久精品综合一区二区三区| 久久91精品国产91久| 亚洲国产精品无码久久SM| 香蕉久久夜色精品国产小说| 久久只有这精品99| 日日狠狠久久偷偷色综合96蜜桃 | 亚洲伊人久久成综合人影院| 亚洲一区中文字幕久久| 久久99热这里只有精品66| 久久99精品国产麻豆| 久久人与动人物a级毛片| 亚洲欧美另类日本久久国产真实乱对白| 亚洲国产精品无码久久98| 日本久久中文字幕| 国产69精品久久久久9999| 国产巨作麻豆欧美亚洲综合久久 | 天天躁日日躁狠狠久久| 无码任你躁久久久久久老妇| 亚洲综合久久综合激情久久 | 久久婷婷国产综合精品| 污污内射久久一区二区欧美日韩| 免费精品99久久国产综合精品| 99久久99这里只有免费的精品| 中文字幕无码久久人妻| 久久久精品久久久久特色影视| 色综合久久综合网观看| www.久久热.com| 99精品国产在热久久无毒不卡| 一本色道久久综合亚洲精品| 三级三级久久三级久久| 99精品国产综合久久久久五月天 |