Do you always need to perform a 'copy' job? Why not select the 'move' option instead to avoid this altogether?
Otherwise, do you want to include a step to delete the shadow-vm within the same script or as a 1-off script?
Thanks for the reply. Yes, in our situation we do need to copy the Temapltes across our datastores. This is so that when we deploy from those templates on the other datastores, then the environments/vApps will be thin provisioned (linked clones) from the template that resides on their "local" datastore. It also makes deployments MUCH faster when deploying vapps to same datastore.
Ideally, we'd look to include the deletion of shadow vms in the existing script we have, to be run after the copies had completed. Having said that, I can see it also being run outside of the main script, if we look to do a cleanup of any rogue shadows.
I have since managed to find this:
which lists all shadow VMs but now the question is how to delete these records?