TFSLabConfig UpdateServiceAccountOnDeployedEnvironments Command

Adds or changes the service account of all or some of the existing environments in a team project collection to the current service account of the team project collection. The service account is used by test agents and build agents in a team project collection to communicate with test and build controllers.

Required Permissions

To use the UpdateServiceAccountOnDeployedEnvironments command, you must have the Manage Lab Locations permission at the Team Project Collection Host Group level. By default, the members of the Team Foundation Server Administrators and Project Collection Administrators groups have this permission. For more information, see Team Foundation Server Permissions.

TFSLabConfig UpdateServiceAccountOnDeployedEnvironments



Collection: collectionUrl

Required. The URL of the team project collection on the application tier of Team Foundation Server to associate with the credentials. that contains the team project. If the LabEnvironmentIds option is not specified, all environments in the team project collection are updated.


One or more comma-separated identifiers of the team project collection environments that you want to update. You can view the environment identifiers in the Environment Viewer of Lab Management and from the XML description of the virtual machine in SCVMM Admin Console.

The service account of a team project collection are set by the TfsLabConfig SetServiceAccount command or in the User Account tab of the Create Team Project Collection dialog box.

For increased readability in the example, command options are listed on separate lines. In a command prompt window, type all options for a command on the same line.

The first example updates the service account of all environments in a team project collection. In the second example, only the specified environments are updated.

REM First example
TFSLabConfig UpdateServiceAccountOnDeployedEnvironments

REM Second example
TFSLabConfig UpdateServiceAccountOnDeployedEnvironments
    /collection:http:// contosotfs:8080/TFS/DefaultCollection