Skip to content

Instantly share code, notes, and snippets.

@nshores
Created October 5, 2021 00:04
Show Gist options
  • Save nshores/519c7e1243725e98e4526d9ef0011342 to your computer and use it in GitHub Desktop.
Save nshores/519c7e1243725e98e4526d9ef0011342 to your computer and use it in GitHub Desktop.
vmdk_duptes.ps1
#https://blog.milla-online.de/duplicate-disk-uuids-and-how-to-get-rid-of-it-hopefully
# get all hard disks
Write-Host "Get all hard disks... " -NoNewline
$alldisks = Get-VM | Get-HardDisk
Write-Host ("Found " + $alldisks.Count)
# filter disks for duplicate uuids and show the "disk.enableUUID" parameter
Write-Host "Filter for duplicate uuids... " -NoNewline
$diskswithduplicateuuids = $alldisks | Select-Object -Property Parent,Name,@{N="Disk-Uuid";E={$_.ExtensionData.Backing.Uuid}} | Group-Object -Property Disk-Uuid | Where-Object -FilterScript { $_.Count -ne 1 } | Select-Object -ExpandProperty Group
Write-Host ("Found " + $diskswithduplicateuuids.Count)
$diskswithduplicateuuids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment