Hey Folks!
We’re having issues with orphaned snapshots being left behind on failed Hyper-V backups. The script I run to delete the old snaps is fairly straightforward:
Get-VMSnapshot -VMName VMNAME | Remove-VMSnapshot
Doing this is fairly quick, but I figured I could automate this if I put a little more effort in. Here’s what I have so far.
If I run the following script on the Hyper-V Host I get a nice little CSV file with the names that would be the “VMNAME” above:
Get-VM | Select-Object Name | Export-CSV PATH -NoTypeInformation
It’s here that I’m struggling to read the CSV file and populate the “VMNAME” portion from the CSV file? Any help would be greatly appreciated!
James