VicMware
Contributor
Contributor

find out if a harddisk has snapshots and whether its a virtual or physical RDM hard disk

Hi

How do I find out if a harddisk has snapshots and whether its a virtual or physical RDM?

$vhdds = $vm | get-harddisk
"find out each $vhdds has snapshots and whether its a virtual or physical RDM"

Reply
0 Kudos
LucD
Leadership
Leadership

I don't think you can have snapshots of RDM disks, so not sure what exactly you mean ?


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

Reply
0 Kudos
VicMware
Contributor
Contributor

Sorry I didnt make it clear

First thing I want to do:
how do I check if the hard disk is a RDM?

$vhdds = $vm | get-harddisk

check each $vhdds if its a RDM

Second thing I want to do:

$vhdds = $vm | get-harddisk

check each $vhdds has a snapshot or not

Reply
0 Kudos
LucD
Leadership
Leadership

The disktype can be deduced from the DiskType property

Get-VM | Get-HardDisk | select @{N="VM";E={$_.Parent.Name}},Name,DiskType

To test if the VMDK has a snapshot can be done by checking through a RegEx expression on the VMDK filename

Get-VM | Get-HardDisk | select @{N="VM";E={$_.Parent.Name}},Name,Filename,
 
@{N="Snapshotted";E={$_.Filename -match '-\d{6}.vmdk'}}

I included the Filename so you can see what is tested against.


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

Reply
0 Kudos