PowerShell: Remove locked Instant-Clone objects

In this blog I will try to explain how you can delete locked Instant-Clone objects. My colleague Marc already explained how you can do it in the GUI, so if you are not familiar with scripting/PowerShell then this blog is a good alternative.

IMPORTANT: Making changes to the MOB (internal API) is not supported and used at own risk. Not sure what u are doing? contact VMware support!

So how do we start? In my script I made some assumptions like the use of dvSwitches and vlan IDs used in the names of your distributed port groups.
Step 1 is to login to the vCenter and the MOB url.

Step 2 is to get de MoRef IDs from the VMs in your vlan.

Step 3 is to build the body to execute the API call for each VM.

The result is that for a cp-template, cp-replica or cp-parent the option “delete form disk” becomes available in vCenter.
So now you can delete the linked-clone leftovers.

The full PowerShell script (function) can be found here: https://github.com/Sader82/DaaS/blob/master/Enable-VMMethods.ps1

Source: https://www.virtuallyghetto.com/2016/07/how-to-easily-disable-vmotion-cross-vcenter-vmotion-for-a-particular-virtual-machine.html

2,852 total views, 18 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code