VMware Cloud Community
COS
Expert
Expert
Jump to solution

VMDK - Get list of vmdk's with duplicate UUID's.

Is it possible to get a list of vm's and their vmdk's and find the ones that have duplicate UUID's?

Thanks

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

To get the list you can do

Get-VM -PipelineVariable vm |

Get-HardDisk |

Select @{N = 'VM'; E = { $vm.Name } }, Filename,

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

To find the HD with duplicate UUIDs, you could do

Get-VM -PipelineVariable vm |

Get-HardDisk |

Select @{N = 'VM'; E = { $vm.Name } }, Filename,

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

Group-Object -Property Uuid |

where { $_.Count -gt 1 } |

Select Name, @{N = 'VMs'; E = { $_.Group.VM -join '|' } }


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

To get the list you can do

Get-VM -PipelineVariable vm |

Get-HardDisk |

Select @{N = 'VM'; E = { $vm.Name } }, Filename,

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

To find the HD with duplicate UUIDs, you could do

Get-VM -PipelineVariable vm |

Get-HardDisk |

Select @{N = 'VM'; E = { $vm.Name } }, Filename,

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

Group-Object -Property Uuid |

where { $_.Count -gt 1 } |

Select Name, @{N = 'VMs'; E = { $_.Group.VM -join '|' } }


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
COS
Expert
Expert
Jump to solution

I put the ft -autosize but it still truncates the list with ...

How do you set the output to not truncate?

Doing an out-file results in the same thing.

Reply
0 Kudos
COS
Expert
Expert
Jump to solution

Putting the below gave something more readable...

out-string -Width 1600

Thanks

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can also display it as a list with Format-List.

Or export it to a file.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos