Pages

Thursday, February 4, 2016

VM Ware - Get UUID of every host in a vSphere

I made use of virt-who to scan my vSphere environment and populate Satellite 6 with what guests are running on which hosts as well as enter the hosts into the Content Hosts section so I could assign them subscriptions.

When virt-who adds an ESX host, it names it with it's UUID in Content Hosts, which can get confusing later.  I wanted to rename the content host entry to be the actual ESX host name. To do this, I had to figure out what the UUID of each ESX host was and there's not an easy way to do this in the vSphere client.

PowerCLI to the rescue!


  1. Open power CLI
  2. Connect to the vCenter
    1. Connect-VIServer <vserver name>
  3. You will get prompted by windows for authentication
  4. Run this command to see the UUID's for every host in that vCenter
    1. Get-View -ViewType HostSystem -Propert Name, hardware.systeminfo | Select Name, @{N="UUID" ; E={$_.hardware.systeminfo.uuid } }
  5. Match up the UUID's from the command with the UUID entries in Content Hosts. Rename them with their real name.
  6. Done!