Hi guys,
I have 2 issues in one segment of code:
$oldVM=Get-VM-Name$targetVMname Get-HardDisk-VM$oldVM | Remove-HardDisk-DeletePermanently-Confirm:$false Remove-VM-VM$oldVM-DeletePermanently:$true-Confirm:$false The problem is that just the VMDK is left behind afterwards in the VM datastore folder. Hence "-DeletePermanently" is not fully effective... Anyone had this problem? I know the workaround is to go down the path of creating a function where you specify the datastore, the folder and the file name to delete the orphan OS VMDK - but the above code should work! I've even got the code there for deleting the disk first before attempting to delete the whole VM.