Removing a Temporary Template from System Center Virtual Machine Manager 2012 R2 using PowerShell.

While going through a house cleaning task in System Center Virtual Machine Manager 2012 R2, I found that I couldn’t remove a vhdx file that was part of a template.This is because the vhdx still had a dependency called “Temporary Template11ef26ce-a6bd-421b-86f2-9cacd0e0f484”:

Template00

Since I couldn’t remove the temporary template from the graphical user interface, I resorted to powershell to accomplish this with the Get-SCVMTemplate cmdlet. The screen below shows a snapshot of the result:

Get-SCVMTemplate

The result from the above query is piped to the Remove-SCVMTemplate to remove the erring template:

Remove-Template

PS C:\scripts> Get-SCVMTemplate -Name "Temporary Template11ef26ce-a6bd-421b-86f2-9cacd0e0f484" | Remove-SCVMTemplate

After running the script successfully, the dependency is seen to be removed.

4 responses to “Removing a Temporary Template from System Center Virtual Machine Manager 2012 R2 using PowerShell.”

  1. otelifantastic Avatar
    otelifantastic

    Well done. #Genius

  2. rishipandit Avatar

    Great post, Thanks a lot.

  3. rishipandit Avatar

    Great post, Thanks a lot.

  4. mke Avatar
    mke

    Deleting the template will affect the vms created from it?

Leave a reply to rishipandit Cancel reply

Chinny Chukwudozie, Cloud Solutions.

Passion for all things Cloud Technology.