Search This Blog

Friday, April 6, 2012

An Easy way to get VMhost UUID

I saw a blog for getting a VMhost UUID.  UUID is sometimes needed. In my case I needed it to license EMC Powerpath VE.

There's a an easy way than going through all that.

Get-VMhost | Get-View | % { $_.hardware.systeminfo.uuid }

That's it. If you want to get fancy and have a need for speed (if you have many VMhosts):

Get-View -ViewType HostSystem -Propert Name, hardware.systeminfo -Filter @{"Name"="VMHostNameHere" }  | % { $_.hardware.systeminfo.uuid }

If you want to get even fancier and return the host name with the UUID, here's a little trick using SELECT:

Get-View -ViewType HostSystem -Propert Name, hardware.systeminfo -Filter @{"Name"="VMHostNameHere" }  | Select Name, @{N="UUID" ; E={$_.hardware.systeminfo.uuid } }

Notice the "N=" and "E=" clauses? N means NAME and E means expression.

No offense to . Visit it, It's a nice blog.


  1. None taken at all. It's nice to see how different people tackle different issues. I mentioned in the comments after your comment on my post that the guts are essentially the same, I just put a lot of logic into it.

  2. Hello,
    I am able to retrieve all of the UUIDs for every guest VM using the following:

    get-vm $vm | ForEach-Object {(get-view $} | Out-File d:\ps\uuid.txt

    How do I display the name and UUID of each guest?