Skip to content

Instantly share code, notes, and snippets.

@yitsushi
Created June 28, 2011 10:35
Show Gist options
  • Save yitsushi/1050877 to your computer and use it in GitHub Desktop.
Save yitsushi/1050877 to your computer and use it in GitHub Desktop.
Get VirtualBox info with ruby...
require "rubygems"
require "virtualbox"
vms = VirtualBox::VM.all
vms.each do |vm|
puts <<EOI
#{vm.name}
#{"="*vm.name.length}
Memory: #{vm.memory_size} MB
CPU count: #{vm.cpu_count}
OS Type: #{vm.os_type_id}
Status: #{vm.state}
EOI
puts ""
end
=begin
OUTPUT:
Ubuntu Test Machine
===================
Memory: 512 MB
CPU count: 1
OS Type: Ubuntu
Status: running
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment