i have came up with script to remove hardisk from backup proxy vms
Get hardisk on backup proxy server which are in Independetnonpersistent state. and remove them
$Hd = Get-HardDisk -VM "XXX" -Server 'xxx' | Where { $_.Persistence -eq 'IndependentNonPersistent'}
$Hd | Remove-HardDisk -Confirm:$true
Re: How to find Base/original disk of VM which is running from snapshot?
I was getting below error earlier when i tried script mentinoed in above post.
Remove-HardDisk : Cannot bind parameter 'HardDisk'. Cannot convert the "[XXX] XX.XX.XX/XX.XX.XX.vmdk" value of type
"System.String" to type "VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.HardDisk".
LucD
Please advice if i am correct.
I already replied on the other thread, but this is my answer.
Not sure what you trying to do, but the filenames that are returned are just the VMDK files that are not attached to a VM.
Meaning the Get-HardDisk cmdlet will not be able to find them this way.
Same goes for the Remove-HardDisk.
If you want to remove orphaned disk files, you might want to take a look at my Orphaned Files And Folders – Spring Cleaning post.
That function also has the option to remove the orphaned files.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Backup software takes snapshot. and then Backup proxy servers attach there client vms vmdk to themselves for backup.
But Incase, of some backup softwares like networker doesn't release these vmdk files post backup is completed to the client machine and this cause Disk Consolidation.
So i want to release those vmdk files from backup proxy server.
as per my research, those files get attached to backup proxy server as "independentnonpersistent"
I see, but then the code you mentioned in the beginning should correct.
Perhaps add a WhatIf switch to the Remove-HardDisk cmdlet to make sure it actually removes what you want to remove.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference