Showing posts with label ESXi. Show all posts
Showing posts with label ESXi. Show all posts

Friday, May 17, 2019

Fix Stuck VMware Tools Install

When automatic VMware tools upgrades is enabled in vCenter, sometimes the ISO will unmount before the installer notifies vCenter that the installation is done.  This will cause vCenter, and the host the VM is registered on, to think that VMware tools installation is still in progress even though it is complete.  The VM will be left in a state where it can't migrate, which means the host is unable to enter maintenance mode.  To fix this, we need to manually kill the process within ESXi that is running the stuck tools installation.

Start by enabling SSH on the affected host, then use Putty (or the SSH client of your choice) and login to the host.  Run the commands below to get the process ID for the affected VM and then to kill the installation process.

Within your SSH session, run the command:

vim-cmd vmscv/getallvms

Find the VMID of the VM with the stuck tools installation and run the command:

vim-cmd vmsvc/tools.cancelinstall id_number

Replace "id_number" with the correct VMID found with the first command.  This will kill the VMware tools installation process allowing the VM to be moved with vMotion and the host to enter maintenance mode.

Friday, August 14, 2015

Enable SSH on Multiple ESXi Hosts With PowerCLI

Enabling SSH on a large cluster of ESXi hosts through both the desktop vSphere client and the vSphere web client can be a real pain and a huge time suck.  Using VMware's PowerCLI, it's really easy to enable SSH on all hosts connected to a vCenter server with one command.

Open PowerCLI, connect to your vCenter server and run the command:

Get-VMHost | Foreach { Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} ) }

To turn it off again:

Get-VMHost | Foreach { Stop-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} ) }