VMware Cloud Community
Roger_Thomas
Contributor
Contributor
Jump to solution

Is there a command line option to suspend all active VM's?

I've lost all the management interfaces to my VMWARE server (3.5 with all patches) and need a way to suspend (or shutdown) all the VMs that are currently running. Is there a simple command for doing this?

Thanks

Roger

0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

Hi Roger,

There is a way from the command line using vmware-cmd utility

try this

for vm in $(vmware-cmd -l)

do

vmware-cmd $vm suspend trysoft

done

View solution in original post

0 Kudos
5 Replies
oreeh
Immortal
Immortal
Jump to solution

You can suspend a single VM using vmware-cmd with the suspend command.

To get help about vmware-cmd usage simply execute it without any arguments.

0 Kudos
Roger_Thomas
Contributor
Contributor
Jump to solution

Thanks, but

I'm aware of the basic vmware-cmd but am looking to see if anyone can point me in the direction of a solution that can handle all the VMs at once.

Roger

0 Kudos
admin
Immortal
Immortal
Jump to solution

Hi Roger,

There is a way from the command line using vmware-cmd utility

try this

for vm in $(vmware-cmd -l)

do

vmware-cmd $vm suspend trysoft

done

0 Kudos
Roger_Thomas
Contributor
Contributor
Jump to solution

Thanks, I have no clue about shell (and no time to read up on it today) so this is very helpful.

Roger

0 Kudos
oreeh
Immortal
Immortal
Jump to solution

Write a script similar (this script tries to suspend every VM even stopped ones) to the following

#!/usr/bin/perl -w

use strict;

my @vmxlist = `vmware-cmd -l`;

foreach my $vmx (@vmxlist) {
chomp($vmx);
my $output = `vmware-cmd \"$vmx\" suspend`;
}