locked
Power shell script for creating Team project collection with the existing empty database RRS feed

  • Question

  • Power shell script for creating Team project collection with the existing empty database

    I have below sample power shell script to create project collection which is working fine,but this is script creates a new database along with team project collection.How to create new project collection with the existing empty database by using power shell script..?

    Load client OM assembly.
    [Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\TestAgent\Microsoft.TeamFoundation.Client.dll"); [Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\TestAgent\Microsoft.TeamFoundation.Common.dll"); [Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\TestAgent\Microsoft.VisualStudio.Services.Client.dll"); [Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\TestAgent\Microsoft.VisualStudio.Services.Common.dll");

    $instanceBaseUrl = "http://TFSserver:8080/tfs/"; $tfsServer = new-object Microsoft.TeamFoundation.Client.TfsConfigurationServer $instanceBaseUrl;

    $tpcSvc = $tfsServer.GetService([Microsoft.TeamFoundation.Framework.Client.ITeamProjectCollectionService]);
    $job = $tpcSvc.QueueCreateCollection( "SampleMyCollectionNameTest_1215", # collection name.
    "", # description. 
    $false, # don't make this the default collection. 
    "~/SampleMyCollectionNameTest_1215/", # virtual directory. 
    "Started", # State after creation. 
    $null, # no tokens. 
    "Server=SLQ\Instance;Integrated Security=SSPI;", # The SQL instance to create the collection on. Specify SERVER\INSTANCE if not using default instance 
    $null, # null because the collection database doesn't already exist. 
    $null) # null because the collection database doesn't already exist.
    $collection = $tpcSvc.WaitForCollectionServicingToComplete($job)


    Wednesday, December 28, 2016 6:23 PM