How to: Save the Current State of Your Environment

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

You can save your environment by either taking a snapshot or saving a copy of the entire environment in the library. If you want to save the state of a running environment, you must take a snapshot of the environment. A snapshot is a file-based copy of the state, disk data, and configuration of all virtual machines in an environment at a specific point in time. For example, you might want to take a snapshot after you have configured your virtual environment. The snapshot is saved on the host and is available for you to revert to later.

If you want to save the whole environment so that you can deploy it again in future, you have to first shut down the environment, and then save it to the team project library. When you save an environment to the team project library, both the environment and the snapshots are saved in the team project library.

Snapshots of the Environment

Snapshots are stored on the Hyper-V hosts itself, and use the differencing disk technology to store the only changes from last snapshot. Because the snapshot will be used later, you must take steps to make it usable for long periods of time.

To prepare for the snapshot

  1. Make sure that the virtual machines in the environment have the latest updates for their operating systems.

  2. If any virtual machine in the environment is connected to a domain, open a command prompt and run the command gpupdate /force. This makes sure that any changes to user policies are updated on the virtual machine. If you do not run this command, your deployment scripts might not work correctly or your tests might not run correctly.

  3. Make sure that the state of the environment is Running and that the state of the workflow capability is Ready.

    Note

    If one or more of the virtual machines in this snapshot are joined to a domain and the snapshot is used for longer than the machine password expiry period, the virtual machines might be unable to join the domain again when the snapshot is restored. One way to avoid this problem is to disable or change the machine password renewal frequency. For more information about password renewal and the security implications for changing or disabling the renewal, see Machine Account Password Process.

  4. You should take snapshots only when there are no transactions in progress between the virtual machines within the environment or between the virtual machines inside the environment and machines outside the environment. If there are TCP connections between machines at the time that the snapshot is taken, these connections might break when the machines are stopped to take the snapshot. When the snapshot is restored, the old, active connections will have timed out and will no longer be valid. After the snapshot is restored, the TCP connections are reestablished. It is not possible to always resume the environment exactly from the point the snapshot is taken.

  5. (Optional) If you want to run tests on the restored snapshot, make sure that the testing capability is Ready.

You use the Microsoft Environment Viewer to connect to the environment and take the snapshot.

To take a snapshot

  1. In Microsoft Test Manager, in the Lab Center, on the Lab tab, select the environment, click the virtual machine, and then click Connect.

  2. In Microsoft Environment Viewer, click the Snapshots tab.

  3. Click the Take snapshot icon.

  4. In the Snapshot environment dialog box, type the name for the snapshot, and then click Take snapshot.

    After the snapshot is completed, you can see the snapshot name in the left pane.

It is easy to accumulate snapshots of an environment. Although each snapshot captures just the differences in the environment between the previous snapshot and the current state, it still requires space to store the snapshot. You should occasionally review the list of snapshots to determine whether there are any that are no longer needed and can be deleted.

To delete a snapshot

  1. In Microsoft Test Manager, in the Lab Center, on the Lab tab, click the virtual machine, and then click Connect.

  2. In Microsoft Environment Viewer, click the Snapshots tab.

  3. In the list of snapshots, right-click the snapshot to delete, and then click Delete snapshot.

  4. In the confirmation dialog box, click Delete snapshot.

Storing the Whole Environment

Before you can store an environment, the environment must be in the Stopped state. You cannot store an environment that is in the Running state.

If you store an environment and do not plan to delete the original active environment immediately, we recommend that you turn on the network isolation capability of the stored environment. This lets another user to deploy a copy of the stored environment. For the steps to turn on the network isolation capability, see How to: Create and Use a Network Isolated Environment.

To store the environment in the Library

  1. In Microsoft Test Manager, in the Lab Center, on the Lab tab, click the environment you want to save.

  2. Click Store in library.

  3. In the Store in library dialog box, type the Environment name and Description of the saved environment.

  4. Click the Project library share from the drop-down list, and then click Store.

    A progress bar is displayed during the creation process. You can also view the current creation step displayed under each virtual machine. When the process is finished, the stored environment appears in the list of Environments on the Library tab.

See Also

Concepts

Planning and Setting Up Your Virtual Lab

Other Resources

How to: Run Manual Tests and Create Reproducible Bugs With Virtual Environments