Cain Manor

Your Guide To All Things Cain™

Find what your Guest OS is on an ESX cluster

This is done on Win­dows, using Pow­er­shell and the VI Toolkit.

First you have to con­nect to the server

Connect-VIServer localhost

Now run the command

get-vm | %{
$vm = "" | Select Name, OSFullname
$vm.Name = $_.Name
$guest = $_ | Get-VMGuest
$vm.OSFullName = $guest.OSFullName
$vm
}

The out­put will have a win­dows return char­ac­ter (/r) you need to be aware of. I opened the file in Tex­tWran­gler and saved it again to get rid of it, but that’s not an ideal solu­tion. This will not show you the OS of hosts that are down, but that’s OK for now.

EDIT — This should work

tr -d '\r' < your_file > new_file

Comments are closed.