up vote 0 down vote favorite
share [g+] share [fb]

I know I can suspend a given VMware virtual machine on the command line with:

vmrun suspend /path/to/virtual_machine_file.vmx

Is there any way to suspend all virtual machines at once using vmrun? Something like vmrun suspend all?

link|improve this question

79% accept rate
feedback

1 Answer

up vote 0 down vote accepted

Well I was hoping for an easy answer but since there wasn't one, I wrote my own script. I hope this is helpful to someone! It's in ruby -- when run, it will call vmrun list to obtain a list of all running VMs, strip off the first line ("Total running VMs: x"), and call vmrun suspend on all remaining lines.

#!/usr/bin/ruby

VMRUN='/usr/bin/vmrun'

vms = []
open("|#{VMRUN} list") do |p| vms = p.readlines.map {|l| l.chomp } end
vms.shift
vms.each do |vmxfile|
  print "Suspending #{vmxfile}"
  system("#{VMRUN} suspend #{vmxfile}")
end
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.