Collection Command
You can use the Collection command to attach, detach, or delete a team project collection from a deployment of Visual Studio Team Foundation Server. You can also use the Collection command to duplicate the database of an existing collection, rename it, and attach it to the deployment. This process is sometimes referred to as cloning a collection. However, you cannot use the Collection command to create a team project collection. For more information, see Create a Team Project Collection.
To manage collections interactively or to create a collection, you can use the Team Project Collections node in the administration console for Team Foundation. For more information, see Open the Team Foundation Administration Console and Organizing Your Server with Team Project Collections.
Required Permissions
To use the Collections command, you must be a member of the following groups:
the Team Foundation Administrators security group and the Administrators security group on the server or servers that are running the administration console for Team Foundation
the sysadmin group on the server or servers that are running the instance of SQL Server that hosts the databases for Team Foundation Server
the Farm Administrators group for the farm from which you are deleting the site collection, if your deployment uses SharePoint Products and you are using the /delete option.
For more information, see Team Foundation Server Permissions.
Note
Even if you log on with administrative credentials, you must open an elevated Command Prompt window to perform this function on a server that is running Windows Server 2008. To open an elevated Command Prompt window, click Start, right-click Command Prompt, and then click Run as Administrator. For more information, see this page on the Microsoft Web site: User Account Control.
TFSConfig Collection {/attach | /detach | /delete} [/collectionName:CollectionName] [/collectionDB:ServerName;DatabaseName] [/clone]
Parameters
Placeholder |
Description |
---|---|
CollectionName |
Specifies the name of the team project collection. If the name of the collection contains spaces, you must enclose the name in quotation marks (for example, "My Collection"). |
ServerName |
Specifies the name of the server that hosts the configuration database for Team Foundation Server, and the name of the instance if you want to use an instance other than the default instance. If you specify an instance, you must use the following format: ServerName\InstanceName |
DatabaseName |
Specifies the name of the configuration database. By default, the name of this database is TFS_ConfigurationDB. |
Option |
Description |
---|---|
/attach |
Required if neither /detach nor /delete is used. If you specify this option, you must also use the /collectionDB option. As an option, you can also use /collectionName and /clone with this option. If you use the /attach option, the specified collection database will be added to your deployment of Team Foundation Server. |
/detach |
Required if neither /attach nor /delete is used. If you specify this option, you must also use the /collectionName option. If you use the /detach option, the database for the specified collection will be stopped, and the collection will be detached from your deployment of Team Foundation Server. |
/delete |
Required if neither /detach nor /attach is used. If you specify this option, you must also use the /collectionName option. If you use the /delete option, the database for the specified collection will be stopped, and the collection will be permanently detached from Team Foundation Server. You will not be able to re-attach the collection database to this or any other deployment. |
/CollectionName:CollectionName |
Required if either /detach or /delete is used. If you use this option with /detach or /delete, it specifies the collection that will be detached or deleted. If you use this option with /attach, it specifies a new name for the collection. If you use this option with both /attach and /clone, it specifies the name for the duplicated collection. |
/CollectionDB:ServerName;DatabaseName |
Required if /attach is used. This option specifies the name of the server that is running SQL Server and the name of the collection database that is hosted on that server. |
/clone |
If you specify this option, the original collection database will be attached as a clone in SQL Server, and this database will be attached to TFS. This option is primarily used as part of splitting a team project collection. |
Example
The following example shows how to permanently remove the "Contoso Summer Intern Projects" team project collection from a deployment of Team Foundation Server.
Note
The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, email address, logo, person, places, or events is intended or should be inferred.
TFSConfig Collection /delete /CollectionName:"Contoso Summer Intern Projects"
TFSConfig - Team Foundation Server Configuration Tool Copyright © Microsoft Corporation. All rights reserved. Deleting a team project collection is an irreversible operation. A deleted collection cannot be reattached to the same or another Team Foundation Server. Are you sure you want to delete 'Contoso Summer Intern Projects'? (Yes/No) Yes Found Collection 'Contoso Summer Intern Projects' Deleting... The delete of collection 'Contoso Summer Intern Projects' succeeded.
The following example shows how to duplicate the "Contoso Summer Interns Projects" team project collection, name it "Contoso Winter Interns Projects," and attach the duplicate collection to the deployment of Team Foundation Server.
TFSConfig Collection /attach /collectiondb:"ContosoMain;TFS_Contoso Summer Interns Projects" /CollectionName:"Contoso Winter Intern Projects" /clone
See Also
Tasks
Move a Team Project Collection
Split a Team Project Collection
Concepts
Backing up and Restoring Your Deployment