Posts Tagged ‘ESX CLI’

Suspend a machine and shutdown VMware ESX 4.1 in a hurry

Tired of waiting for VMware vSphere Client to connect to your ESX host, perform an inventory just so you can suspend your VM and shutdown your ESX server?

If you haven’t already enabled sshd on your ESX host do so now.

Thomas Maurer has an easy to follow guide with screen shots – Activate SSHd on ESX 4.1.

If you have an older version you’ll need to switch to ALT-F1 and type unsupported then vi /etc/inetd.conf, uncomment sshd, followed by /sbin/ restart (or a reboot).

For more info on how to enable sshd in older versions of ESX check out ESXi (ESX 3i) Enable SSH

ssh into your ESX 4.1 and login as root…

Using the ESX CLI or ESX Command Line Interface or ESX Console to issue the following commands:

# Get a list of all VMS currently on the ESX host
vim-cmd vmsvc/getallvms

# Suspend Virtual Machine 32 (From output of previous command)
vim-cmd vmsvc/power.suspend 32

# Flush disks

# Power off

If you are doing this nightly replace 32 in the second command above with the VM id of your machine and copy and paste this all into the ssh window and walk away.