2 Replies Latest reply on Aug 20, 2019 12:30 PM by DanMan3395

    Compare vmdk UUID to Windows Disk UUID

    DanMan3395 Novice

      In windows, a Get-Disk will produce a list of disks with serial numbers. In vMware, a (get-harddisk -vm $vmname).ExtensionData.Backing.Uuid will produce a list of vmdk UUIDs which match the serial numbers produced in windows.


      I want to use this fact to correlate what disk in windows resides on what vmdk/vmware disk in vCenter. I would also like to correlate the windows volume name as well. However, i am struggling to get the logic to actually work.

        • 1. Re: Compare vmdk UUID to Windows Disk UUID
          LucD Guru
          vExpertCommunity WarriorsUser Moderators

          There are a couple of conditions for this to work.
          This works for Windows 10 and 2016, when

          • VMware Tools are installed and running
          • the advanced setting 'disk.EnableUUID' needs to be set to TRUE (see KB52815)

          Disclaimer 1: I only tested this with Windows 10 and Server 2016

          Disclaimer 2: this only works for disks. There is afaik no fool-proof method to map guest OS partitions to VMDK


          $vmName = 'MyVM'

          $user = 'LucD'

          $pswd = 'VMware1!'

          $code = @'

          Get-Disk | Select DiskNumber,SerialNumber | ConvertTo-Csv


          $vm = Get-VM -Name $vmName

          if ($vm.Guest.State -ne 'Running')


             if ((Get-AdvancedSetting -Entity $vm -Name 'disk.EnableUUID').Value -eq 'true')


              $diskTab = @{ }


              Invoke-VMScript -VM $vm -ScriptText $code -GuestUser $user -GuestPassword $pswd |

              select -ExpandProperty ScriptOutput | ConvertFrom-Csv |

              ForEach-Object -Process {

               $diskTab.Add($_.SerialNumber, $_.DiskNumber)


             Get-HardDisk -VM $vm |

             Select @{N = 'VM'; E = { $_.Parent.Name } }, Name,

               @{N = 'Uuid'; E = { $_.ExtensionData.Backing.Uuid } },

               @{N = 'WinDisk'; E = { $diskTab[$_.ExtensionData.Backing.Uuid.Replace('-', '')] } }




             Write-Host 'Serial number not showing (see KB52815)'





             Write-Host "VMware Tools need to be installed and running"





          Was it helpful? Let us know by completing this short survey here.



          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          1 person found this helpful
          • 2. Re: Compare vmdk UUID to Windows Disk UUID
            DanMan3395 Novice

            This is similar to what I was working on only much better. I to am thinking that a volume mapping just cannot be done. I cannot seem to find any kind of unique identifier to tie it into. Thanks LucD, as always, you were shockingly helpful!