Changes

Jump to: navigation, search
no edit summary
<tt>"[Vol1] win2008/win2008.vmx"</tt>
Bringing all of these different command line arguments together, a typical ''vmrun'' command to start a virtual machine on a host named ''vmhost'' running VMware Server 2 might appear as follows:
<pre>
vmrun -T server -h https://vmhost:8333/sdk -u root -p mypassword stop "[Vol1] win2008/win2008.vmx"
</pre>
==Performing General Administrative Tasks with vmrun ==
The ''vmrun'' tool can be used to perform a number of general administrative tasks such as listing running virtual machines, installing VMware Tools in a guest operating system and registering virtual machines.
<pre>
vmrun -T server -h https://myhost:8333/sdk -u root -p mypassword -gu root -gp 3579xps installTools "[Vol1] CentOS 5.2/CentOS 5.2.vmx"
</pre>
<pre>
vmrun -T server -h https://vmhost:8333/sdk -u root -p mypassword stop "[Vol1] win2008/win2008.vmx" soft
</pre>
<pre>
vmrun -T server -h https://vmhost:8333/sdk -u root -p mypassword reset "[Vol1] win2008/win2008.vmx"
</pre>
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword snapshot "[Vol1] CentOS 5.2/CentOS 5.2.vmx" MySnapshot
</pre>
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword revertToSnapshot "[Vol1] CentOS 5.2/CentOS 5.2.vmx" MySnapshot
</pre>
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword start "[Vol1] CentOS 5.2/CentOS 5.2.vmx"
</pre>
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword deleteSnapshot "[Vol1] CentOS 5.2/CentOS 5.2.vmx" MySnapshot
</pre>
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword -gu fred -gp guestpasswd fileExistsInGuest "[Vol1] CentOS 5.2/CentOS 5.2.vmx" /home/fred/MyFile
The file exists.
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword -gu fred -gp guestpasswd deleteFileInGuest "[Vol1] CentOS 5.2/CentOS 5.2.vmx" /home/fred/MyFile
</pre>
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword -gu fred -gp guestpasswd createDirectoryInGuest "[Vol1] CentOS 5.2/CentOS 5.2.vmx" /home/nas/foo
</pre>
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword -gu fred -gp guestpasswd deleteDirectoryInGuest "[Vol1] CentOS 5.2/CentOS 5.2.vmx" /home/nas/foo
</pre>
To list the files in a guest system directory:
<pre>vmrun -T server -h https://xps:8333/sdk -u root -p 3579xps -gu fred -gp guestpasswd listDirectoryInGuest "[Vol1] CentOS 5.2/CentOS 5.2.vmx" /home/fred
Directory list: 5
.esd_auth
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword -gu fred -gp guestpasswd copyFileFromGuestToHost "[Vol1] CentOS 5.2/CentOS 5.2.vmx" /home/fred/MyFile /tmp/MyFile
</pre>
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword -gu fred -gp guestpasswd copyFileFromHostToGuest "[Vol1] CentOS 5.2/CentOS 5.2.vmx" /tmp/MyFile /home/fred/MyFile
</pre>
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword -gu fred -gp guestpasswd renameFileInGuest "[Vol1] CentOS 5.2/CentOS 5.2.vmx" /home/fred/MyFile /home/fred/MyNewFile
</pre>
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''. The name of the file to which the image is to 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>
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword -gu fred -gp guestpasswd captureScreen "[Vol1] CentOS 5.2/CentOS 5.2.vmx" /home/fred/images/vm_screen.png
</pre>
1,798
edits

Navigation menu