Share via


How to manually remove a “temporary template” from System Center Virtual Machine Manager

You may find that when removing VM templates from System Center Virtual Machine Manager (multiple versions, including 2012 SP1), you are unable to remove the vhd file that was part of a template. This occurs because the vhd that remains still has a dependency called Temporary Template <GUID>.

For example, you remove a template from the VM Templates section of the library. This template referenced a VM stored in the VMM Library. Next, you attempt to delete the vhd file itself  from the library, and you receive an error that you cannot delete the file because it has a dependency. When you look at the Dependencies section in the file properties, you see something like this:

 

 

image

 

If this happens, it should eventually clear up when VMM does some house cleaning. However, you may not be willing to wait for that to happen. In order to delete the template immediately, you can user PowerShell. In this example, I ran the following command to remove the temporary template:

 

PS C:\Windows\system32> remove-scvmtemplate -vmtemplate "Temporary Template1c2fe 00e-4d16-4975-b85b-8c4fad34fff5"

 

Once completed, the template (dependency) is removed as seen below:

image

 

You will now be able to delete the vhd file.