Compartilhar via


Enabling Host based connection for virtual environments

Once you create/compose a virtual environment, you can connect to it for doing manual testing etc. Environment Viewer can offer you a Host based or a Guest based connection, depending on various scenarios. Refer to this MSDN article for details: https://msdn.microsoft.com/en-us/library/ee518907.aspx. In summary, host based connections are are routed through the Hyper-V hosts on which the virtual machines reside. Apart from meeting the OS requirements, you need to be an environment owner to get a Host based connection. Host-based connections are better for interacting with virtual machines when they are booting up. Also the screen resolution of the Virtual Machine is preserved in a Host-based connection. Note: there can be only one active host based connection to an environment at any point of time.

In case you want to provide Host based connection to an another user (other than the Environment owner), you can update the owner of the virtual machines. Follow these steps:

  1. Install the Lab Management GDR on Team Foundation Server: https://support.microsoft.com/?kbid=983578. It is also recommended that you install the patch on Microsoft Test Manager (MTM) machine also.
  2. Run the attached script using Power Shell 2.0

Usage:

.\UpdateVMOwner.ps1 -tfsurl 'https://<MyTFS>:8080/tfs/<MyCollection>' -environmentUri 'vstfs:///LabManagement/LabEnvironment/<ID>' -vmOwner '<domain\user>'

(Updates the owner of all the virtual machines in the environment)

or

.\UpdateVMOwner.ps1 -tfsurl 'https://<MyTFS>:8080/tfs/<MyCollection>' -environmentUri 'vstfs:///LabManagement/LabEnvironment/<ID>' -vmOwner '<domain\user>' -LabSystems 'TestVM1, TestVM2'

(you can provide comma separated list of the names of the virtual machines in the environment)

E.g.

.\UpdateVMOwner.ps1 -tfsurl 'https://abc-tfs:8080/tfs/DefaultCollection' -environmentUri 'vstfs:///LabManagement/LabEnvironment/37' -vmOwner 'contoso\elvis'

You can find the ID of environment using MTM.

Env-ID

After you have successfully run this script, you can check the connection type using environment viewer (shown at the bottom)

Env Viewer

You need to remove the .txt file extenstion type of the attached script.

UpdateVMOwner.ps1.txt