PrepSQL Command

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

You can use the PrepSQL command to prepare an instance of SQL Server to host the databases that Visual Studio Team Foundation Server uses. This command creates the permissions groups in SQL Server that Team Foundation Server requires (TFSExecRole and TFSAdminRole) and populate those groups with the account that was used to run this command.

Required Permissions

To use the PrepSQL command, you must be a member of the Team Foundation Administrators security group and a member of the sysadmin security group for any SQL Server databases that Team Foundation Server uses. For more information, see Team Foundation Server Permissions.


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 click Run as Administrator. For more information, see this page on the Microsoft Web site: User Account Control.

TFSConfig PrepSQL /SQLInstance:ServerName[\InstanceName]





Specifies the name of the server that you want to host the databases for Team Foundation Server. If you want to use an instance other than the default instance, you must also specify the name of the instance, in the following format, that you want to use:

ServerName \ InstanceName



/SQLInstance: ServerName

Specifies that you want to host databases for Team Foundation Server on the designated server.


You use the PrepSQL command to use an installation of SQL Server that was not configured for Team Foundation Server when that software was installed. For example, you would use this command if you restore data for Team Foundation Server to a different server. You would also use this command to host databases for team project collections on a server that is running SQL Server but has not been previously used with Team Foundation Server.


The following example shows how to prepare a server that is running SQL Server and that is named ContosoMain on the named instance TeamDatabases to host databases for Team Foundation Server.


You cannot specify what accounts to populate in the TFSExecRole and TFSAdminRole groups when you use this command. These groups will be created and populated with the account under which you are running this command.

TFSConfig PrepSQL /SQLInstance:ContosoMain\TeamDatabases

See Also

Other Resources

Managing Server Configuration with TFSConfig