VMware Automation
This tutorial is dedicated to control Virtual Machines only on WorkStation.
Getting started with VMRUN command
- Pre-Requistes:
- .Have a workstation installed on your host machine
- Install any Virtual machine of your choice in the WorkStation
- Locate the path of vmrun.exe file.
- 32 Bit Machine -The default location is C:\Program Files \VMware\VMware VIX
- 64 bit machine -The default location is C:\Program Files (x86)\VMware\VMware VIX
- Locate path of .vmx or .vmtm file
- The default path is C:\Documents and Settings\<username>\My Documents\My Virtual Machines\Windows 8X62\Windows 8x64.vmx
- Steps 1: In the host machine where workstation is installed open command prompt in administrator mode.
- Step 2: Navigate and open vmrun.exe.
In this case it is located in C:\Program Files (x86)\VMware\VMware VIX
- Step 3:Now type vmrun in the command prompt.
Vmrun Commands:
The commonly used commands are shown below:
Example:To perform the following tasks:
- Start VM with a known username and password
- Run calculator program in VM
- Take snapshot of the VM
- The below command starts the vm where username is "gpb" and password is "a"
- vmrun -gu gpb -gp a start "C:\Users\gpb\Documents\Virtual Machines\Windows 8 x64(2)\Windows 8 x64 (2).vmx"
- The below command runs calaculator program
- vmrun -gu gpb -gp a runprograminguest "C:\Users\gpb\Documents\Virtual Machines\Windows 8 x64 (2)\Windows 8 x64 (2).vmx" -nowait -interactive "C:\Windows\system32\calc.exe"
- The following command takes a snapshot with snapshot name as demo
- vmrun snapshot "C:\Users\gpb\Documents\Virtual Machines\Windows 8 x64 (2)\Windows 8 x64 (2).vmx" demo
To run all these commands together we can store these commands in a batch file and execute the corresponding batch script.
To learn about creating batch files click on next tutorial!
No comments:
Post a Comment