Error 804: Hung Template Creation in SCVMM 2008 R2

Table of contents

When creating an SCVMM 2008 R2 template from a virtual machine that does not support Sysprep (such as Linux), it sometimes gets stuck during the Sysprep phase. It never ends in an error or proceeds past that point, and you are unable to delete it or restart the job. Depending on your scenario, the template may not be immediately visible, but an attempt to create a new template with the same name results in “The template TEMPLATENAME already exists. Specify a unique name for the template, and then try the operation again. ID: 804”.

Hung Template - SCVMM 2008 - 1

To find the hung template, switch to the “Library” tab and highlight “Library Servers” on the left pane. Your hung template should be visible in a fashion similar to the following screen shot. Note that the Library Server is just “VMMServer” and not the actual library server’s name. Because of this, the template will only be visible in this location. Also note that the status is “Under Creation”.

It is recommended that you first switch to the Jobs tab and attempt to stop anything outstanding and that you attempt a reboot. In order to clear the hung job itself, it may be necessary to remove the host from the SCVMM console and re-add it, although this will not clear the hung template.

The underlying problem is that the template’s status is set in SCVMM’s database and there’s nothing that comes along to check up on it. You need to manually modify the database.

To perform these steps, you’ll need a copy of SQL Management Studio 2008 or greater. If you don’t have a full copy of Microsoft SQL Server, you can get the Express edition of this tool from Microsoft’s download site. It also comes bundled in other distributions of SQL Express. You can search MSDN and the download site for SQL Server Express to find these other packages.

These directions will assume that you installed SQL Management Studio directly to the machine that is running the server component of SCVMM. It is possible to connect remotely, but that will require extra configuration steps that could compromise the security of your installation so those steps are not included here.

  1. When opening SQL Management Studio, you’ll be presented with a connection dialog like the one below. Fill it out as shown:
    Hung Template - SCVMM 2008 - 3

      1. If you get an error that the database doesn’t exist, open SCVMM. Switch to the “Administration” tab. Click the “General” sub-tab. In the center pane, double-click “Database Connection”. The information in this dialog can be used to populate the SQL login box:
        Hung Template - SCVMM 2008 - 4
        Since you’re working locally, you don’t enter the server name, you use “.\” instead, so for the above screenshot, “.\VMMSERVER” is what is to be put into the login’s “Server Name” field.
      2. If you get a login failure, you’ll need to login as a user who has been given administrative access to the database. You may need to use SQL credentials. These items will have been setup during the installation of SCVMM.
  2. Once connected, expand “Databases”. If you haven’t taken a backup recently, right-click on “VirtualManagerDB”, go to “Tasks” and “Back up…” and save a full copy of the database.
  3. Expand “VirtualManagerDB” and expand “Tables”.
  4. Right-click on “dbo.tbl_WLC_VObject” and click on “Select Top 1000 Rows”. When the grid displays, sort the columns or scroll through and look for an item with an ObjectType of 3 and an ObjectState of 2. Verify that the name matches what you expect.
    Hung Template - SCVMM 2008 - 5
  5. Again, right-click on “dbo.tbl_WLC_VObject” but this time, click “Edit top 200 Rows” (if you have more objects than this, hopefully you have access to a database administrator that can assist you with creating these scripts). Find the item from step 3. Click on its ObjectState so that you can edit the field and change it from 2 to 0. The change is saved as soon as you press enter or change focus. Do NOT delete the row or you will cause orphaning problems in your database!
    Hung Template - SCVMM 2008 - 6
  6. You can simply wait until SCVMM re-reads the database or you can manually restart the Virtual Machine Manager service. You will now be able to operate on the template. The status of this template is at best questionable, so don’t try to use it. Use the SCVMM interface to delete it.


Altaro Hyper-V Backup
Share this post

Not a DOJO Member yet?

Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!

Leave a comment or ask a question

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

Your email address will not be published.

Notify me of follow-up replies via email

Yes, I would like to receive new blog posts by email

What is the color of grass?

Please note: If you’re not already a member on the Dojo Forums you will create a new account and receive an activation email.