Was trying to delete a VM template but it kept throwing the above error. I had a feeling this was because the underlying disk was missing in the datastore (because I couldn’t find any folder with the same name as the VM in the datastore) but there was no way to confirm this as you can’t right click a VM and note its settings.
Thanks to PowerCLI though, you can:
1 2 3 4 5 6 |
PowerCLI> Get-HardDisk -Template "2012R2_Gold (Aug2014)" | fl FileName Filename : [xxxDATA01] 2012R2_Gold (Aug2014)/2012R2_Gold (Aug2014).vmdk Filename : [xxxDATA01] 2012R2_Gold (Aug2014)/2012R2_Gold (Aug2014)_1.vmdk |
The Get-HardDisk
cmdlet can be used to return the hard disks used by a VM or template. It can even be used to return all hard disks on a datastore (or in a specified path on the datastore):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
PowerCLI C:\> Get-HardDisk -Datastore "xxxData02" CapacityGB Persistence Filename ---------- ----------- -------- 40.000 Unknown [xxxDATA02] VS-EXCH01/VS-EXCH01.vmdk 250.000 Unknown [xxxDATA02] VS-EXCH01/VS-EXCH01_1.vmdk 40.000 Unknown [xxxDATA02] VS-WSCOM01/VS-WSCOM01.vmdk PowerCLI C:\> Get-HardDisk -Datastore "xxxData02" -DatastorePath "[xxxDATA02] VS-DC01" CapacityGB Persistence Filename ---------- ----------- -------- 20.000 Unknown [xxxDATA02] VS-DC01/VS-DC01_1.vmdk 20.000 Unknown [xxxDATA02] VS-DC01/VS-DC01.vmdk |