Linux Articles January 20, 2011 1

Managing VMware images from command line using vmrun tool

Managing VMware images in VMware Server 2.x can be done in several ways. One way is to utilise Web based GUI and the second way is the command line.

To login to the Web based GUI

  • (SSL) https://hostname:8333/ui/#
  • http://hostname:8222/ui/# (How to disable redirect to SSL could be foundĀ here)

Let’s get focused on Shell commands – application: vmrun


Listing VM’sĀ 

#To List registered VMs
[email protected]:~$ vmrun -T server -h 'http://localhost:8222/sdk' -u user \
-p password listRegisteredVM

Total registered VMs: 10
[standard] MyImageDir/my_wmware_image.vmx

# To List all running VMs
[email protected]:~$ vmrun -T server -h 'http://localhost:8222/sdk' -u user \ 
-p password list

#privileged user:

read -s -p "Password: " PASS
echo "Registered VMS:"
vmrun -T server -h 'http://localhost:8222/sdk' -u ${user} -p ${PASS} listRegisteredVM

echo "Running VMs:"
vmrun -T server -h 'http://localhost:8222/sdk' -u ${user} -p ${PASS} list


#Starting a virtual machine with Workstation on a Linux host
[email protected]:~$ vmrun -T server -h 'http://localhost:8222/sdk' -u user -p password start "[standard] MyImageDir/my_wmware_image.vmx"

#Stopping a virtual machine
[email protected]:~$ vmrun -T server -h 'http://localhost:8222/sdk' -u user -p password stop "[standard] MyImageDir/my_wmware_image.vmx"

#make sure you will use exact syntax as above (including [standard] - which is a storage name)
#additional tasks: reset, suspend, pause, unpause


#Creating a snapshot of a virtual machine
[email protected]:~$ vmrun -T ws snapshot "/home/user/MyVms/MyImageDir/my_wmware_image.vmx" mySnapshot

#Reverting to a snapshot
[email protected]:~$ vmrun -T ws revertToSnapshot "/home/user/MyVms/MyImageDir/my_wmware_image.vmx" mySnapshot mySnapshot

#Deleting a snapshot
[email protected]:~$ vmrun -T ws deleteSnapshot "/home/user/MyVms/MyImageDir/my_wmware_image.vmx" mySnapshot mySnapshot

For more options please refer to $vmrun –help pages.


By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.