If you are using FlexClone functionality of NetApp array to create and destroy LUN and Volume clones in automated way, you probably had such situations where snapshots need to be destroyed, but array doesn't let you to delete snapshot because is busy with clone. Finding such Volume or LUN clones sometimes is challenging task requires executing multiple commands.
My customer has automated system which creates hundreds and thousands of clones every day and sometimes fails to clean up. As a result it leaves Storage Administrator with task of cleanings snapshots and clones after such failures. To make this task a bit easier I put together GetSnapshotClones.ps1 script to extract Volume and LUN clones dependent on Snapshot of the Volume. Script takes two parameters - Volume and Snapshot and returns array of clone objects.
Here is an example of calling script and script output.
PS C:\@work\Scripts> .\GetSnapshotClones.ps1
Name : Win2K8R2_VOL_FUJI_16
ParentVolume : Win2K8R2_VOL_MASTER
ParentLun :
CloneType : Vol
ParentSnapshot : clone_Win2K8R2_VOL_FUJ.1
Name : Win2K8R2_VOL_FUJI_15
ParentVolume : Win2K8R2_VOL_MASTER
ParentLun :
CloneType : Vol
ParentSnapshot : clone_FUJI_15_BOOT_VOL.1
Name : Win2K8R2_VOL_FUJI_14
ParentVolume : Win2K8R2_VOL_MASTER
ParentLun :
CloneType : Vol
ParentSnapshot : clone_FUJI_14_BOOT_VOL.1