This is a quick how to article on using some basic command line tools to administer VMware server 2 virtual machines running on a Linux system. In my case I am running Vmware Server on Centos 5.4 but I’m sure this will be very similar if not exactly the same on other versions of Linux.
Anyway here is the small problem I ran into. I wanted to get a list of running virtual machines on my centos server so I used the command
vmrun list
If memory serves me corretly this used to spit back a list of the running vms. However the above command now returns
Error: Malformed hostname parameter. For the given service provider, the hostname must be a URL, in the form https://
: /sdk
The correct command that did work was
vmrun -h https://localhost:8333/sdk -u adminusername -p adminpassword list
The above command would then produce the following output.
Total running VMs: 1[standard] XPPro/XPPro.vmx
The command above can be adjusted accordingly run other functions on the vm as well (start, stop, pause, etc…). Please see the full documentation on the vmware.com website.
I not sure when the command changed (perhaps for better security in the latest vmware server software) but the above steps now get me to where I need to be.
Hope this helps someone else.
For other VMware articles please click here
If you're not willing to type your password in command line, you may create a script like this one below.
Don't forget to change settings for your own environment.
#!/bin/bash
me=`/usr/bin/whoami`
this=`/usr/bin/basename $0`
if [ -z $1 ]; then
/bin/echo "Usage: $this [parameters]"
exit 0
fi
read -p "User [$me]: " user
if [ -z $user ]; then
user=$me
fi
read -sp "Password: " pass
/bin/echo -e "n"
/usr/bin/vmrun -h https://localhost:8333/sdk -u $user -p $pass "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"