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.

Comments

  • Anonymous
    January 26, 2014
    Thanks a lot .. its really saved my time and work .. I need one more help .. I facing one issue in VMM2012 SP1. virtual machine guest services i am not able see 2012 R2 and windows 8.1. this my mail ID :- ravi.vm1982@hotmail.com
  • Anonymous
    January 31, 2014
    Confirmed still an issue in VMM 2012 R2
  • Anonymous
    April 15, 2014
    When does this house cleaning take place?
  • Anonymous
    February 06, 2015
    THANK you for this tip. Saved me a lot of aggravation :-) BTW, I don't think SC VMM 2012 R2 does any housekeeping job which removes this temporary template. Mine stayed there for many days until I deleted it using your procedure.
  • Anonymous
    February 11, 2015
    Thanks! Huge help
  • Anonymous
    February 15, 2015
    very informative
  • Anonymous
    October 19, 2016
    Thanks for this dude :)
  • Anonymous
    June 09, 2017
    Yay! This worked perfectly. This was for a missing ISO file in a library. Once I removed the two temporary templates I was able to delete the ISO, and the folder it was in went away too!