The information on this page applies to older version of the tool.
The toolkit is available on http://vslabmgmt.codeplex.com
as a Zip file. The Zip file contains the following
- Powershell script : new-templatefromvm.ps1
- This is the main script that is used to create the Lab ready VM templates. The PowerShell script uses SCVMM cmdlets and HyperV WMI interfaces to manage the conversion of VM to a Lab Ready Template
- LabMgmt.ISO ISO file
- The ISO contains scripts and tools that are used to install Team Agents and configure them appropriately for Lab integration.
- A template file for specifying the input parameters to the script.
- User Guide
Pre-requisites and Checklist before for running the tool
The VM Prep Tool takes a deployed virtual machine as a starting point, installs and configures build and test agents on it and converts it into a VM template.
- The tool has dependencies on following software components, ensure they are installed and configured correctly.
- Windows PowerShell 1.0
- SCVMM Administrator Console
- Ensure System Center Virtual Machine Manager is installed with host and library share correctly configured.
- The credentials used to run the tool must be an SCVMM administrator.
- Additionally, the SCVMM administrator must be an administrator on the SCVMM Host.
- The following virtual machine configuration is supported in this release:
- Operating System: Windows Server 2008 SP2, Windows Server 2008 R2, Windows7
- Memory configuration should be at least 1024 MB
- The Virtual Machine must be on the network
- Ensure that the Secondary channel 0 and 1 shouldn’t have been mapped already for the VM.
- WMI service should be enabled on the machine and WMI and Remote Administration should be allowed through any firewall on the machine.
Steps to install and run the tool
- Go to http://vslabmgmt.codeplex.com and
- Download the current stable release drop on to your SCVMM administrator desktop
- Right click on the zip file -> Properties. On bottom of the General Tab click “Unblock”. Click Apply and Ok (This will enable executing the contained script on your machine)
- Unzip the downloaded Zip file to a folder on your desktop e.g. VMTool
- Download the installer ISOs for Visual Studio Team Foundation Server and Visual Studio Team Agents from the following locations
- Copy the ISO files onto your SCVMM library share
- Copy VMTool\LabMgmt.ISO onto your SCVMM library share.
- Copy TFS ISO onto your SCVMM library share.
- Copy Team Agents ISO onto your SCVMM library share.
- Refresh the library share after copying the ISO files.
- Go to SCVMM administrator console and select a virtual machine for conversion to Lab Ready VM Template. The virtual machine must meet the pre-req requirements specified above and should be in the stopped state.
Note that the tool will modify the original Virtual Machine and will remove it as part of the templatization process. Create a clone virtual machine to backup as a best practice.
- Provide the input parameters by editing VMTool\InputFile.xml. The following parameters are needed
- VMMServer: Name of the SCVMM server
- LibraryShareName: Name of the Library share on which the ISOs were uploaded
- VMName: Name of the Virtual Machine that will be converted
- VMAdminUserName: Specify domain account in “<domain>\<user>” format to be used to connect to the virtual machine
- VMAdminPassword: Specify password for the account to be used to connect to the virtual machine.
- TFSISOName: Name of the TFS ISO file uploaded to the library share (typically VS2010B2TFS1.iso)
- DTEISOName: Name of the Team agent ISO file uploaded to the library share (typically VS2010B2Agent1.iso)
With the above parameters, the VM will be configured with default settings. The Test Agent will be configured to run as Network Service and the Build Agent will be configured to run as Local System. You can also specify the following optional parameters if additional configuration is required.
- TAServiceUser: Username of a local user account to be used to configure test Agent service (the tool will create the account)
- TAServicePassword: Password of a local user account to be used to configure Test agent service. Ensure the password meets the password policy of the machine and domain.
- BAServiceUser: Username of a local user account to be used to configure build Agent service (the tool will create the account)
- BAServicePassword: Password of a local user account to be used to configure build agent service. Ensure the password meets the password policy of the machine and domain.
- TCServiceUser: Username of a local user account to be used to enable configuration and communication with test Controller ((the tool will create the account)
- TCServicePassword: Password of a local user account to be used to enable configuration and communication with test Controller. Ensure the password meets the password policy of the machine and domain.
- GoldenTemplateName(Optional): Name of the golden template that will be created
- Owner (Optional): Specifies the Owner of the template file
- LabMgmtISOName (Optional): Name of the LabMgmt ISO file. Use this parameter in case you rename the file.
Please refer to Lab Management installation/configuration guide on how the user accounts are used
- You are now ready to run the tool. On your SCVMM administrator desktop.
- Launch Windows Powershell Virtual Machine Manager console in an elevated mode. (Start->All Programs-> Microsoft System Center-> Virtual Machine Manage 2008 R2 -> Right Click on Windows PowerShell Virtual Machine Manager -> Run as Administrator
- Enable Script execution (if disabled) by running the following on the prompt:
- Set-executionpolicy RemoteSigned
- change the current directory to the VMTool folder on your desktop.
- Ensure the script is unblocked so it can run on your machine. (Right click-> properties, click unblock if the file is blocked)
- Run the tool and pass the InputFile as a parameter
- .\new-templatefromvm.ps1 –FilePath InputFile.xml
- The script takes around one hour to run and will reboot a few times. Once the script completes a VM Template will be available in the SCVMM library with the <GoldenTemplateName> that you provided. This template has all the required agents installed and configured. Once you have Lab Management setup, you can import this template into the Lab library and use it to create Lab Environments.
The following are the known issues with the current release, we are working on fixing these and will release an update to the tool.
- Current release is tested on Windows Server 2008 Sp2, Windows Server 2008 R2 and Windows7.
- The release is supported on Domain joined machines. There is a known issue with Workgroup machines and default Windows Firewall setting. We suggest disabling firewall on the VM as a temporary work-around on Work-group machines.
- THe VMAdmin credentials must be the built-in adminstrator account when connecting to Workgroup machines.
- The account used to run the tool must be administrator on the host used to deploy the virtual machine
- Password provided for build and test agent and controller accounts must meet machine and domain password policy.
- *** Ensure that the Secondary channel 0 and 1 shouldn’t have been mapped already for the VM. The script needs to mount ISOs and will fail if they the channels are already mapped.
- Template creation could fail during sysprep step due to rearm issue. Refer http://support.microsoft.com/default.aspx?scid=kb;EN-US;929828 for rearm issues. This error may occur if the Windows Software Licensing Rearm program has run more than three times in a single Windows Vista+ image. To workaround, ensure that the input VM used for template creation has not be created in this way VM1 -> Template1 -> VM2 -> Template2 -> Input VM.
- If the VMM connection is lost between the VMM Administrative Console and the VMM Server, the script will fail. Re-run the tool when the connection is available.