Changes

Jump to: navigation, search
Virtual Machine Snapshots with vmrun
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword deleteSnapshot
"[Vol1] CentOS 5.2/CentOS 5.2.vmx" MySnapshot
</pre>
 
== Running, Listing and Killing Guest Programs and Scripts with vmrun ==
 
One of the most useful features of the ''vmrun'' command is the ability to run and manage programs on the guest operating system of a virtual machine.
 
A listing of the current process running on a guest operating system can be obtained using the ''listProcessesinGuest'' command. In order for this command to work, a valid guest user name and passowrd must be provided. The following example show a typical command used to obtain a process listing from a Windows Server 2008 system, together with part of the output listing:
 
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword -gu administrator -gp guestpasswd
listProcessesInGuest "[Vol1] win2008-1/win2008-1.vmx"
 
Process list: 39
pid=0, owner=, cmd=[System Process]
pid=4, owner=, cmd=System
pid=392, owner=, cmd=smss.exe
pid=468, owner=, cmd=csrss.exe
pid=512, owner=, cmd=csrss.exe
pid=520, owner=, cmd=wininit.exe
pid=548, owner=, cmd=winlogon.exe
pid=596, owner=, cmd=services.exe
.
.
.
</pre>
 
To run a program within a guest operating system, use the runProgramInGuest command. For example:
 
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p 3579xps -gu administrator -gp guestpaswd
runProgramInGuest "[Vol1] win2008-1/win2008-1.vmx" -activeWindow "c:\windows\system32\cmd.exe"
</pre>
 
Note that in order to run a graphical application on a Windows Vista or Windows Server 2008 guest, the ''-interactive'' command must be used. Without this commands, the guest operating system display an ''Interactive services dialog detection'' warning dialog stating that the program cannot be displayed on the desktop.
 
By default, graphical programs started using ''vmrun'' on Windows guests will start in a minimized state (in other words the program will appear in the Windows task bar, but will not be displayed on the desktop). To force the program to appear on the desktop when it starts, the ''-activeWindow'' flag must be used. The following example shows the combined use of the ''-interactive'' and ''-activeWindow'' flags to run and display the Windows Notepad program on a Windows Server 2008 guest system:
 
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p 3579xps -gu administrator -gp Iltsonitm129
runProgramInGuest "[Vol1] win2008-1/win2008-1.vmx"
-activeWindow -interactive "c:\windows\system32\notepad.exe"
</pre>
 
To terminate a program running in a guest operating system, use the ''listProcessesInGuest'' command described above to ascertain the process id (pid) of the program in question and use that id (2368 in the following example) together with the ''killProcessInGuest'' command:
 
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p 3579xps -gu administrator -gp guestpasswd
killProcessInGuest "[Vol1] win2008-1/win2008-1.vmx" 2368
</pre>
1,798
edits

Navigation menu