How to: Create a Virtual Machine or Template from an Environment

As you create, use, and store virtual environments, you might find it necessary or desirable to use a virtual machine from one environment as part of another environment. Although you cannot copy and paste a virtual machine directly from one environment to another, you can save the virtual machine from the first environment into the team project library and then deploy the saved virtual machine into the second environment. Saving virtual machines lets team project members create virtual machines or templates without having to request assistance from system administrators, who use System Center Virtual Machine Manager (SCVMM).

You can save a virtual machine in the Library as a template or as a stored virtual machine. The procedure contains three main steps:

Step 1: Prepare the Virtual Machine to be Stored in the Team Project Library

Step 2: Create the Template or Stored Virtual Machine in the Library

Step 3: Restore the Configuration of the Deployed Virtual Machine

Step 1: Prepare the Virtual Machine to be Stored in the Team Project Library

To store a virtual machine from a deployed environment, follow these steps to prepare the virtual machine for re-use. Many of these steps will have already been taken when the virtual machine was deployed to the environment.

To prepare a deployed machine to be stored in the library

  1. Make sure that the environment is running.

  2. Use Environment Viewer to connect to the environment and then to the virtual machine.

  3. Make sure that remote desktop connections to this virtual machine are enabled.

    1. On the virtual machine, click Start, right-click Computer and then click Properties.

    2. In the Systems dialog box, click Remote settings.

    3. On the Remote tab of the System properties dialog box, click the appropriate Allow connections option, and then click OK.

  4. Make sure that the appropriate Test Manager and Lab Management agents are installed. For more information, see the following sections of the Installing and Configuring Visual Studio Agents and Test and Build Controllers topic.

    Lab agent

    Install a lab agent

    Test agent

    Install a test agent

    Build agent

    Install a build controller or build agent

  5. If the virtual machine is joined to a domain, remove it from the domain and join it to a workgroup. If you are want to store it as a virtual machine, change the computer name. Restart the machine when you are prompted to do this.

  6. If you want to store the machine as a template, perform the following steps:

    1. Make sure that the administrator password and local password policy are cleared.

      Open gpedit.msc, and then click Local Computer Policy, Computer Configuration, Windows Settings, Security Settings, Account Policies, and then Password Policy. Then set the following values:

      Enforce password history

      0

      Maximum password age

      0

      Minimum password age

      0

      Minimum password length

      0

      Password must meet complexity requirements

      Disabled

      Close gpedit.msc

    2. Change the password of local Administrator account to be empty.

      Log in as Administrator and then use CTRL+ALT+DEL to change the password.

Step 2: Create the Template or Stored Virtual Machine in the Library

After you prepare the virtual machine, perform the following steps to create a template or stored virtual machine in the team project library.

To select the virtual machine to store in the team project library

  1. Click Lab Center and then click the Lab tab.

  2. Select the environment that contains the virtual machine to be stored. Make sure that the environment has been shut down. You can only save a virtual machine from an environment when the environment is in the Stopped state.

  3. In the right-side pane, select the virtual machine to be stored in the library. Click Store in library, and then fill in the required information in the storage wizard.

Creating a stored VM from a deployed environment

To use the storage wizard to create the stored virtual machine or template

  1. Enter the name and location for the stored virtual machine or template. For more information about individual properties, see the Name and location properties section in the topic How to: Set the Properties of a Virtual Machine or Template.

  2. Select the Store as template check box to create a template in the library. Clear the check box to create a stored virtual machine.

  3. Click the following tabs on the wizard to set additional properties of the stored virtual machine or template. For more information, see the corresponding sections in How to: Set the Properties of a Virtual Machine or Template.

    Tab

    Properties

    Hardware profile

    Size of memory

    OS profile

    Templates only. Operating system type, computer name, administrator password, product key, domain and workgroup for virtual machines deployed from the template. Stored virtual machines inherit this information from the source virtual machine.

    Machine tags

    User defined custom properties to track for the stored virtual machine or template.

  4. Select Save and close to close the dialog box, and to initiate the process of storing the virtual machine into library.

Note   While a virtual machine from an environment is being stored in library, you cannot start the environment or perform other operations on it. You may store another virtual machine from the same environment in library at the same time.

Step 3: Restore the Configuration of the Deployed Virtual Machine

After you have created a template or stored virtual machine from a deployed virtual machine, you can restore the deployed virtual machine to its previous state.

Start the environment and then connect to the virtual machine by using Environment Viewer. Use the following check-list to determine what might need to restore or remove. Agents can be removed by using the Program applet in Control Panel. Other settings can be changed by following the same procedures that are described in Step 1: Prepare the Virtual Machine to be Stored in the Team Project Library.

   

Do you need to restore or remove:

   

Remote desktop connections setting

   

Build or test agents.

   

The computer name

   

The connection to a domain

   

The administrator and local password policy

   

The administrator password

See Also

Tasks

How to: Create and Store Virtual Machines and Templates Ready for Lab Management

Concepts

Creating Virtual Environments