Home
Using vmrun to Control Virtual Machines
Contents
1. To use the vmrun command on a Windows system 1 Locate the vmrun program which by default is installed here C Program Files VMware VMware VIX Add the install location to your system path On Windows XP for example choose Computer gt Properties gt Advanced gt Environment Variables gt System variables gt Path gt Edit Using the right arrow key move the input pointer to the end of line add a semicolon the software location path as in step 1 and click OK several times If VMware Workstation is already in Path this step is optional because another vmrun is installed there In a command window type the vmrun command in the following form vmrun lt flags gt lt command gt lt parameters gt Continue with Virtual Machine Run Flags on page 7 Using vmrun on Linux To use the vmrun command on a UNIX system 1 Optional As root or superuser edit the etc 1d so conf file add a line with the library location default directory below save the file and run the ldconfig command usr 1lib vmware vix 1lib In a command or terminal window type the vmrun command in the following form vmrun lt flags gt lt command gt lt parameters gt Continue with Virtual Machine Run Flags on page 7 VMware Inc Using vmrun to Control Virtual Machines Virtual Machine Run Flags On VMware Workstation vmrun controls guest operating systems on the local host so you need not specify a remote host name or port
2. vmrun T ws gu guestUser gp guestPassword runProgramInGuest WinXP vmx C Workarea script bat Run a command script on a Windows guest using Workstation vmrun T ws gu guestUser gp guestPassword runProgramInGuest WinXP vmx C Windows System32 cmd exe c C Workarea script cmd Run a Perl script in a Linux guest to remove DOS style carriage returns from a file vmrun T ws gu guestUser gp guestPassword runScriptInGuest Linux vmx usr bin perl pi tmp dos txt while lt DOS gt s r n n print lt DOS gt open DOS Run a Perl script in a Windows guest to insert DOS style carriage returns into a file vmrun T ws gu guestUser gp guestPasswd runScriptInGuest WinXP vmx C cygwin bin perl exe pi open UNIX VMware Inc C Temp unix txt while lt UNIX gt s n r n print lt UNIX gt Using vmrun to Control Virtual Machines 12 Examples From the Usage Message Start a virtual machine with VMware Workstation on a Windows host vmrun T ws start c my VMs myVM vmx Stop a virtual machine with Server on a Linux host vmrun T server h https myHost com sdk u hostUser p hostPasswd stop storage1 vm myVM vmx Run a program in a virtual machine on a Windows host with a Windows guest vmrun T ws gu guestUser gp guestPassword runProgramInGuest c my VMs myVM vmx c Program Files myProgram exe Run a program in a virtual machine with VMware Server on a
3. Possibly no flags are required In the syntax examples below flags enclosed in angle brackets indicate variables that you fill in For commands that require authentication by the guest operating system the command description states valid guest login required in which case you must use the following flags gu lt userName in guest OS gt gp lt userPassword in guest OS gt To set the host type for remote access to VMware Server 2 0 use the following flags in conjunction T server h lt hostName gt P lt portNumber gt u lt adminLogin on Server gt p lt adminPassword on Server gt For example this command lists all running virtual machines on a remote server vmrun T server h https example com sdk u root p secretpw list For VMware Workstation use the T flag as follows vmrun T ws For VMware Server 1 0 use the T flag as follows vmrun T serverl1 NOTE On VMware Workstation starting a virtual machine with the default gui option requires a window system to be running on the host VMware Server does not impose this requirement VMware Server does not support teams shared folders cloning record and replay or multiple snapshots When you try to create a second snapshot the UI asks if you want to overwrite your existing snapshot Virtual Machine Run Commands VMware stores virtual machines as a package including the virtual machine settings file lt vnname gt vmx and the virtual disks W
4. SDKs and APIs forum which the VMware technical support and product teams monitor You can access the forum at http communities vmware com community developer VMware Inc 3 Using vmrun to Control Virtual Machines Support Offerings To find out how VMware support offerings can help meet your business needs go to http www vmware com support services VMware Education Services VMware courses offer extensive hands on labs case study examples and course materials designed to be used as on the job reference tools For more information about VMware Education Services go to http mylearn1 vmware com mgrreg index cfm 4 VMware Inc Using vmrun to Control Virtual Machines VMware provides an application called vmrun for controlling virtual machines or teams of virtual machines from the command line The vmrun command is available on any VMware product that includes the VIX API libraries or when the libraries are separately installed This chapter contains the following sections About the vmrun Command below m Using vmrun on Windows on page 6 m Using vmrun on Linux on page 6 m Virtual Machine Run Flags on page 7 m Virtual Machine Run Commands on page 7 m Examples of Using vmrun on page 11 About the vmrun Command The vmrun command manipulates virtual machines and runs on any VMware platform where you can install the VIX libraries including VMware Workstation and VMware Se
5. Linux host with a Linux guest vmrun T server h https myHost com sdk u hostUser p hostPasswd gu guestUser gp guestPasswd runProgramInGuest storagel vm myVM vmx usr bin X11 xclock display 0 Create a snapshot of a virtual machine with VMware Workstation on a Windows host vmrun T ws snapshot c my VMs myVM vmx mySnapshot Revert to a snapshot with VMware Workstation on a Windows host vmrun T ws revertToSnapshot c my VMs myVM vmx mySnapshot Delete a snapshot with VMware Workstation on a Windows host vmrun T ws deleteSnapshot c my VMs myVM vmx mySnapshot C Program Files VMware VMware Workstation Examples from Workstation Manual Reset a virtual machine on Linux vmrun reset usr local VMs lt virtual_machine_name gt vmx soft Reset a virtual machine on Windows vmrun reset C Virtual Machines lt virtual_machine_name gt vmx soft Disabling Dialog Boxes With virtual machines that require input through a VMware Workstation dialog box the vmrun command might time out and fail To disable Workstation dialog boxes insert the following line into the configuration file vmx for a virtual machine msg autoAnswer TRUE VMware Inc
6. Tools and valid guest login are required lt interpreter path gt The interpreter path is the command that run the script lt script text gt Give the complete text of the script not a filename deleteFileInGuest Delete the specified file from the guest operating system lt path to vmx file gt Mware Tools and valid guest login are required lt path to file on guest gt createDirectoryInGuest reate specified directory in the guest operating system lt path to vmx file gt lt directory path on guest gt deleteDirectoryInGuest elete a directory from the guest operating system V Cc VMware Tools and valid guest login are required D VMware Tools and valid guest login are required lt path to vmx file gt lt directory path on guest gt ListDirectoryInGuest List directory contents in the guest operating system VMware Tools and valid guest login are required lt path to vmx file gt lt directory path on guest gt copyFileFromHostToGuest Copy a file from the host to the guest operating system VMware Tools and valid guest login are required Specify source file host before destination file guest lt path to vmx file gt lt file path on host gt lt file path in guest gt copyFileFromGuestToHost Copy a file from the guest operating system to the host VMware Tools and valid guest login are required Specify source file guest before destination file host lt pa
7. or a Linked clone If you want to make the clone from this snapshot rather than from the current virtual machine state specify a snapshot name lt path to vmx file gt lt destination vmx file path gt full Linked lt snapshot name gt VProbes Commands VMware Server does not support VProbes vprobeVersion Show VProbes version lt path to vmx file gt vprobeLoad Load VProbes script lt path to vmx file gt lt text of VProbes script gt vprobeReset Disable all VProbes lt path to vmx file gt vprobeListProbes List active VProbes lt path to vmx file gt vprobeListGlobals List VProbes global variables lt path to vmx file gt Examples of Using vmrun Most examples work on any either VMware Workstation The T ws and T fusion options are synonymous You can derive the guest operating system type in examples by distinguishing for Linux and for Windows New Examples Start an X terminal on a Linux guest requires display option to appear on the console vmrun gu lt user gt gp lt password gt runProgramInGuest Ubuntu Ubuntu vmx usr bin xterm display 0 List processes in a Linux guest on Workstation and kill the process numbered 20001 vmrun T ws gu guestUser gp guestPassword listProcessesInGuest Ubuntu Ubuntu vmx vmrun T ws gu guestUser gp guestPassword killProcessesInGuest Ubuntu Ubuntu vmx 20001 Run a batch script on a Windows guest using Workstation
8. Using vmrun to Control Virtual Machines For VMware Workstation 6 5 and VMware Server 2 0 E vmware Using vmrun to Control Virtual Machines Using vmrun to Control Virtual Machines Revision 20080815 Item EN 000068 00 You can find the most up to date technical documentation on our Web site at http www vmware com support The VMware Web site also provides the latest product updates If you have comments about this documentation submit your feedback to docfeedback vmware com 2008 VMware Inc All rights reserved Protected by one or more U S Patent Nos 6 397 242 6 496 847 6 704 925 6 711 672 6 725 289 6 735 601 6 785 886 6 789 156 6 795 966 6 880 022 6 944 699 6 961 806 6 961 941 7 069 413 7 082 598 7 089 377 7 111 086 7 111 145 7 117 481 7 149 843 7 155 558 7 222 221 7 260 815 7 260 820 7 269 683 7 275 136 7 277 998 7 277 999 7 278 030 7 281 102 7 290 253 7 356 679 7 409 487 7 412 492 and 7 412 702 patents pending VMware the VMware boxes logo and design Virtual SMP and VMotion are registered trademarks or trademarks of VMware Inc in the United States and or other jurisdictions All other marks and names mentioned herein may be trademarks of their respective companies VMware Inc 3401 Hillview Ave Palo Alto CA 94304 www vmware com 2 VMware Inc About This Book This manual Using vmrun to Control Virtual Machines introduces the vmrun command a convenient command to
9. apshot has a unique name within a virtual machine revert to that snapshot by specifying the path to the virtual machine s configuration file and the snapshot name first group of parameters If several snapshots have the same name you can still specify the snapshot by including a path name for the snapshot name A path name is a series of snapshot names separated by forward slash characters Each name specifies a different snapshot in the tree For example the path name Snap1 Snap2 identifies a snapshot named Snap2 that was taken from the state of a root snapshot named Snap1 Parameters lt path to vmx file gt lt snapshot name gt or lt path to vmx file gt lt snap1 snap2 snapN gt Record and Replay Commands beginRecording Recording not supported on VMware Server Begin recording a running virtual machine vmx file storing activity in the specified snapshot object with optional description Only one recording or replay can be active at a time lt path to vmx file gt lt snapshot object name gt lt description gt endRecording End the recording of a virtual machine vmx file thatis lt path to vmx file gt in progress and close its snapshot object beginReplay Begin replaying the recorded activity of a powered off lt path to vmx file gt Replay not supported on VMware Server virtual machine vmx file from a snapshot object Only one recording or rep
10. help you manage the collection of virtual machines on a VMware host Revision History This book is revised with each release of the product or when necessary A revised version can contain minor or major changes Table 1 summarizes the significant changes in each version of this guide Table 1 Revision History Revision Description 20080623 First draft of this manual for the VMware Server 2 0 RC1 and Workstation 6 5 Beta2 releases 20080815 Third draft for the VMware Server 2 0 RC2 and Workstation 6 5 RC releases Intended Audience This book is intended for developers and system administrators who want to control virtual machines on various platforms including VMware Workstation VMware Fusion and VMware Server API and SDK Documentation VMware provides many different products targeting different developer communities and platforms For the most up to date information about API and SDK products this is the place to go http www vmware com support pubs sdk_pubs html Document Feedback VMware welcomes your suggestions for improving our documentation Send your comments to docfeedback vmware com Technical Support and Education Resources The following sections describe the technical support resources available to you You can access the most current versions of other VMware manuals by going to http www vmware com support pubs Online Support You can submit questions or post comments to the Developer Community
11. hen required you must give vmrun the complete path to the vmx file Here are some examples of where the vmx file might be located m On Windows m path on VMware Workstation C Documents and Settings lt username gt My Documents My Virtual Machines Win XP Win XP vmx m data store on VMware Server storagel1 Win XP Win XP vmx m On Linux m path on VMware Workstation home lt username gt VirtualMachines Ubuntu Ubuntu vmx m data store on VMware Server storage1 Win XP Win XP vmx All the vmrun commands and parameters are grouped and documented in Table 2 Parameters are listed one per line Parameters enclosed in square brackets are optional The vertical bar indicates a keyword choice VMware Inc 7 Using vmrun to Control Virtual Machines Table 2 vmrun Commands and Parameters Command Power Commands Description Parameters start Start a virtual machine vmx file or team vmtm file lt path to vmx or vmtm file gt Teams not supported on The default gui option starts interactively which is guilnogui VMware Server required to display a Workstation user interface The nogui option suppresses the user interface including startup dialog box to allow non interactive scripting stop Stop a virtual machine vmx file or team vmtm file lt path to vmx or vmtm file gt Teams not supported on Use the soft parameter to power off the guest after hard soft VMware Server running shutdow
12. lay can be active at a time lt snapshot object name gt endRep Lay End the replaying of a virtual machine vmx file that is currently underway lt path to vmx file gt Guest Operating System Commands runProgramInGuest Run a program in the guest operating system Provide lt path to vmx file gt the full path name of a program accessible to the guest _noWait VMware Tools and valid guest login are required activeWindow Also provide full accessible path names for any files interactive specified in the program arguments lt program name gt The noWait option means to return immediately after lt program arguments gt the program starts in the guest rather than waiting for it to finish This is useful for interactive programs The activeWindow flag ensures that the Windows GUI is visible not minimized It has no effect on Linux The interactive flag forces interactive guest login and is useful for Windows Vista guests to make the program visible in the console window fileExistsInGuest Check whether the specified file exists in the guest lt path to vmx file gt operating system VMware Tools and valid guest login lt path to file in guest gt are required setSharedFolderState Modify the writeability state of a folder shared between lt path to vmx file gt VMware Server does not support shared folders the host and a guest virtual machine vmx file The share name is a mount point i
13. n scripts Use the hard parameter to power off the guest without running scripts as if you pressed the power button The default is to stop using the powerType specified in the vmx file if present reset Reset a virtual machine vmx file or team vmtm file lt path to vmx or vmtm file gt Teams not supported on Use the soft parameter to run shutdown scripts before hard soft VMware Server rebooting the guest Use the hard parameter to reboot the guest without running scripts as if you pressed the reset button The default is to reset using the powerType specified in the vmx file if present suspend Suspend a virtual machine vmx file or team vmtm lt path to vmx or vmtm file gt Teams not supported on VMware Server without shutting down so local work can resume later The soft parameter suspends the guest after running system scripts On Windows guests these scripts release the IP address while on UNIX guests they suspend networking The hard parameter suspends the guest without running these scripts The default is to suspend using powerType specified in the vmx file if present To resume virtual machine operation after suspend use the start command On Windows the IP address is retrieved and on Linux networking is restarted hard soft pause Pause a virtual machine vmx file This is used to pause lt path to vmx file gt replay but can be used in other contexts unpause Unpause a vir
14. n the guest file system The path to folder is the exported directory on the host A shared folder can be made writable or read only lt share name gt lt path to folder on host gt writablel readonly addSharedFolder VMware Server does not support shared folders Add a folder to be shared between the host and guest The share name is a mount point in the guest file system The path to folder is the exported directory on the host lt path to vmx file gt lt share name gt lt path to folder on host gt removeSharedFolder VMware Server does not support shared folders Remove a guest virtual machine s access to a shared folder on the host The share name is a mount point in the guest file system lt path to vmx file gt lt share name gt ListProcessesInGuest List all processes running in the guest operating system VMware Tools and valid guest login are required lt path to vmx file gt VMware Inc Using vmrun to Control Virtual Machines Table 2 vmrun Commands and Parameters Continued Command Description Parameters killProcessInGuest Stop the specified process in the guest operating system lt path to vmx file gt VMware Tools and valid guest login are required lt process ID gt Take process ID from the number listed after pid in the output of ListProcessesInGuest runScriptInGuest Run a command script in the guest operating system lt path to vmx file gt VMware
15. nstalltools Prepare to install VMware Tools in the guest operating lt path to vmx file gt system In Windows guests with autorun enabled the VMware Tools installer starts by itself In Linux guests without autorun this command connects the virtual CD ROM drive to the VMware Tools ISO image suitable for the guest but the installer does not start so you must complete the installation with additional manual steps as described in your product documentation VMware Inc Using vmrun to Control Virtual Machines Table 2 vmrun Commands and Parameters Continued Command register Registration not supported on VMware Workstation Description Register a virtual machine vmx file adding it to the host s inventory Path format depends on the product For VMware Server 2 0 storage1 vm vm vmx starting with data store is typical Parameters lt path to vmx file gt unregister Registration not supported on VMware Workstation Unregister a virtual machine vmx file removing it from the host s inventory Path format depends on the product For Server 2 0 storage1 vm vm vmx starting with data store is typical lt path to vmx file gt clone Cloning not supported on VMware Server Create a copy of the virtual machine and guest operating system Provide the source vmx file path name and the destination vmx file path name You can create either a normal full clone
16. rver For information about the facilities that vmrun controls see the documentation for your product such as the User s Manual This document organizes vmrun commands into the six following categories Power Commands Virtual machine power operations give you these options start power on stop power off reset reboot suspend but allow local work to resume pause without interrupting and unpause continue On some products you can group virtual machines into teams so power operations apply to the whole team Snapshot Commands A snapshot reproduces virtual machine state at the time of the snapshot including all data on virtual disks You can snapshot a virtual machine as you choose in any power state and revert to the snapshot at any time Snapshots are useful for experimentation and especially useful for backups These commands list existing snapshots of a virtual machine create a new snapshot delete a snapshot and revert a virtual machine to its state as of a specific snapshot VMware Server limits you to one snapshot Record and Replay Commands Virtual machine events can be recorded for later replay The recording is called a snapshot object but is really more like a movie At this time only VMware Workstation supports record and replay These commands begin or end the recording of events and begin or end the replay of a recording VMware Inc 5 Using vmrun to Control Virtual Machines Guest Operating S
17. th to vmx file gt lt file path in guest gt lt file path on host gt renameFileInGuest Rename or move a file in the guest operating system lt path to vmx file gt VMware Tools and valid guest login are required lt original filename gt Specify source name original before destination new lt new filename gt captureScreen Capture the screen of the virtual machine to a local file lt path to vmx file gt The specified output file on the host is in PNG format lt output path on host gt A valid guest login is required writeVariable Write a variable into the virtual machine state or guest lt path to vmx file gt You can set either runtime configuration in the vmx file runtimeConfig guestEnv or environment variables in the guest operating system variable names The latter requires VMware Tools and valid guest login lt variable value gt Provide the variable name and its value readVariable Read a variable from the virtual machine state or guest lt path to vmx file gt You can get either runtime configuration in the vmx file or environment variables in the guest operating system The latter requires valid guest login runtimeConfig guestEnv lt variable name gt General Commands list List all running virtual machines None upgradevm Upgrade a virtual machine to the current version of lt path to vmx file gt virtual hardware Has no effect if already current i
18. tual machine vmx file and resume lt path to vmx file gt operation where it paused Snapshot Commands ListSnapshots List all snapshots in a virtual machine vmx file lt path to vmx file gt snapshot VMware Server does not support multiple snapshots Create a snapshot of a virtual machine vmx file For products such as Workstation that support multiple snapshots you must provide the snapshot name Because the forward slash defines path names VMware recommends that you avoid using the slash character when naming a snapshot because that makes it difficult to specify the snapshot path precisely lt path to vmx file gt lt snapshot name gt deleteSnapshot VMware Server always deletes the root snapshot Remove a snapshot from a virtual machine vmx file For products such as Workstation that support multiple snapshots you must provide the snapshot name The virtual machine must be powered off or suspended If this snapshot has children they become children of the deleted snapshot s parent and subsequent snapshots continue as before from the end of chain lt path to vmx file gt lt snapshot name gt VMware Inc Using vmrun to Control Virtual Machines Table 2 vmrun Commands and Parameters Continued Command revertToSnapshot VMware Server always reverts to the root snapshot Description Set the virtual machine state to a snapshot If a sn
19. ystem Commands These are the most distinctive and useful interfaces in the vmrun command You can Run an executable program in the guest operating system or run an interpreted script These interfaces serve a similar purpose but runProgramInGuest provides more fine grained control Check if a file exists in the guest delete a file rename a file list files and create or delete a directory Copy a file from the host to the guest or copy a file from the guest to the host Add a shared folder from the host make a shared folder writable in the guest remove a shared folder or capture a screen image from the guest except on VMware Server List the processes running in the guest operating system or terminate any process with permission Read or write a variable into the guest operating system s environment or virtual machine state General Commands This catch all category includes commands to list all running virtual machines upgrade the virtual machine hardware version and install VMware Tools on the guest Additionally except on VMware Server you can clone any virtual machine image to another virtual machine VMware Server allows you to register and unregister virtual machines VProbes Commands These commands support VProbes a facility for dynamically and statically instrumenting portions of VMware software and a running guest operating system See the VProbes Programming Reference for details Using vmrun on Windows
Download Pdf Manuals
Related Search
Related Contents
取扱説明書 Zebra ET1 4GB Black INSTALLATION, INSTRUCTION AND SERVICE MANUAL Philips PowerTouch Shaving head holder CRP146/01 取扱説明書 - MINIMOTO General Tools DCS280 Use and Care Manual Samsung CLP-350N Εγχειρίδιο χρήσης Christie Mirage 10000 User Manual 2706-6.1, Dl40 Plus User Manual Copyright © All rights reserved.
Failed to retrieve file