Changes

Jump to: navigation, search
m
Text replacement - "<google>BUY_VMWARE_SERVER_2_BOTTOM</google>" to "<htmlet>vmware</htmlet>"
<table border="0" cellspacing="0" width="100%">
<tr>
<td width="20%">[[VMware Server 2.0 Security - Access, Roles and Permissions|Previous]]<td align="center">[[VMware Server 2.0 Essentials|Table of Contents]]<td width="20%" align="right"></td>
<tr>
<td width="20%">VMware Server 2.0 Security - Access, Roles and Permissions<td align="center"><td width="20%" align="right"></td>
</table>
<hr>
 
 
<htmlet>vmware</htmlet>
 
 
For all the ease of use provided by VMware Server's graphical tools, perhaps the most powerful tool supplied with various VMware products is a little known command line utility called ''vmrun''. Installed as standard with VMware Server, ''vmrun'' allows almost total control over virtual machines from the command line, either locally on the VMware Server host, or remotely over a network or internet connection. Capabilities of ''vmrun'' include starting, stopping, pausing, resuming and resetting virtual machines, executing commands within guest operating systems and taking snapshots. The primary goal of this chapter is to focus on these and other features of ''vmrun''.
</table>
The ''command'' argument instructs ''vmrun'' on the task to be performed. For example, ''start'', ''stop'' and ''reset'' are all valid commands. As are the Other valid commands include those to perform tasks within a guest operating system, such as ''runProgramInGuest'' and ''deleteFileInGuest''.
The ''parameters'' arguments specify additional information required for a specific command. If, for example, the ''start'' command is specified, the parameters argument is used to reference the .vmx file of the virtual machine which is to be started. In the case of running guest commands, both the .vmx file of the target virtual machine and the path to the program to be executed must be provided as parameters.
== Running Scripts Within a Guest ==
In addition to running executable programs on a guest operating system, ''vmrun'' also supports the running of scripts. Scripts are generally text based files containing instructions which a are executed by an interpreter. For example, a Perl script would be executed using the ''perl'' interpreter and Ruby script by the ''ruby'' interpreter. Whilst some operating systems and scripting languages allow scripts to be executed just as any other program is executed (and without referring to the interpreter in the command line) this is not always the case. In such situations the command line to execute the script must provide the path to the script as a command line argument to the interpreter. For example, suppose that the following Ruby script contained in a file called ''hello.rb'' located in ''/home/ruby'' needs to be executed:
<pre>
== Using vmrun to Work with Guest Operating Systems Files and Directories ==
A particularly powerful feature of ''vmrun'' is the ability to interact with files residing in a guest operating systems from either the host, or a remote system. For example, vmrun can be used to identify the existence of a file in a specific virtual machine guest, delete a file, create a directory and copy files between guest and host. In each case, a user name and password valid for logging into the guest operating system must be provided using the ''-gu'' and ''-gp'' flags.
The following commands require that VMware Tools be installed in the guest operating system. For more details on VMware Tools refer to the chapter entitled [[Understanding and Installing VMware Tools]].
</pre>
Conversely, the to copy a file from the host to the guest:
<pre>
== Capturing a Virtual Machine Screenshot ==
A screenshot of the console of a running virtual machine may be captured and written to a file on the host using the vmrun ''captureScreen'' command. The name of the file to which the image is to be written is supplied as a parameter to the command. Note that the image is created in PNG format, so the file should be given the appropriate ''.png'' filename extension. For example:
<pre>
"[Vol1] CentOS 5.2/CentOS 5.2.vmx" /home/fred/images/vm_screen.png
</pre>
 
 
<htmlet>vmware</htmlet>

Navigation menu