Stupid Script

I just cobbled this script together to make starting up VirtualBox VM’s a little easier when remote.

for a in `vboxmanage list vms | sed 's/^"\(.*\)".*/\1/'`; \
do echo $a && vboxmanage showvminfo $a | grep -c "running (since" ;done

This will give you a list of all of your VMs. Followed by a 1 if it is powered on or a 0 if it isn’t. If your VM name contains a space, this won’t work. In that case, the following will give you just the list:

vboxmanage list vms

You can then run the following to get all of the information and grep out the “since”

vboxmanage showvminfo "My VM"

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.