This project is read-only.


# Paramètres nécéssaire pour la création d'un nouveau projet

# Adresse du serveur
$adressTFS = 'http://colmar:8080'

# Nom du projet
$ProjectName = "DemoAuto"

# Nom du site web
$SiteName = "DemoAuto"

# Description du site du projet
$SiteDescription = "Site du projet" + $ProjectName
# Emplacement du log
$LogFolder = "c:\temp"

# Type de contrôle de code source, branches
$Branch = "New"

# Nom du ProcessTemplate
$ProcessTemplateName = "MSF for Agile Software Development - v4.2"

# Fichier contenant le paramètrage des comptes
$content = get-content C:\Users\Administrateur\Desktop\PowerShell\users.txt

# Branche de base, emplacement des fichiers
$BranchBase = "C:\Users\Administrateur\Desktop\PowerShell\BranchBase\"

# Description pour l'ajout de la branche
$DescriptionBranch = "Ajout de la branche DEV"

# Label
# Nom du label pour la création de la branche dev
$LabelDev = "Branche DEV"
# Description du label
$LabelDescription = "Création de la branche DEV"
# Elements sur les quels mettre le label
$Item = "$/" + $ProjectName + "/Dev"

#Branche Développement
$BrancheSource = "$/" + $ProjectName + "/Dev"
$BrancheTarget = "$/" + $ProjectName + "/Main"
$BrancheDescription = "Ajout de la branche MAIN"

#Branche Realse
$BrancheReleaseSource = "$/" + $ProjectName + "/Main"
$BrancheReleaseTarget = "$/" + $ProjectName + "/Release"
$BrancheReleaseDescription = "Ajout de la branche RELEASE"

# Récupération du serveur TFS
$tfs = Get-TFS $adressTFS

if($tfs -eq $null)
	Write-Host "Impossible de communiquer avec le serveur"
	# Création du projet
	"Début de la création du projet"

	Add-Project -tfs $tfs -ProjectName $ProjectName 
                          -LogFolder $LogFolder 
                          -ProjectSiteTitle $SiteName 
                          -ProjectSiteDescription $SiteDescription 
                          -SccCreateType $Branch 
                          -ProcessTemplateName $ProcessTemplateName 

	"Création du projet : " + $ProjectName

	$tfs = Get-TFS $adressTFS

	"Liste des projets du serveur"

	Get-AllProjects -tfs $tfs | Format-Table

	# Ajout des utilisateurs
	"Début de l'ajout des utilisateurs suivant"


	foreach ($line in $content) { $tab = $line.split("|") ; Add-MemberProject -tfs $tfs -ProjectName $ProjectName -UserName $tab[0] -Roles $tab[1];}

	"Comptes créés"

	# Ajout de la branche de base
	"Début de l'ajout de la branche de base"
	Add-Files -tfs $tfs -ProjectName $ProjectName -source $BranchBase -description $DescriptionBranch
	"Fichier ajouté"

	# Ajout d'un label avant la création de la branche MAIN
	Add-Label -TFS $tfs -LabelName $LabelDev -Scope $ProjectName -Description $LabelDescription -TypeRecursion  Full -Item $Item

	# Création de la branche DEV
	"Création de la branche DEV"

	Add-Branch -tfs $tfs -projectname $ProjectName -source $BrancheSource  -target $BrancheTarget  -description $BrancheDescription 

	# Création de la branche RELEASE
	"Création de la branche RELEASE"

	Add-Branch -tfs $tfs -projectname $ProjectName -source $BrancheReleaseSource -target $BrancheReleaseTarget -description $BrancheReleaseDescription 


Exécution du script

PSTFS > .\CreateProject.ps1

Début de la création du projet

System has started to create your team project. This may take a while. Please wait ...
The project creation log file with a name like ProjectCreation_2009-01-10_09.10.21.log has been created at C:\Users\Admi
nistrateur\AppData\Local\Temp\, if you did not provide a log file folder.
Otherwise, please find the log file at your_log_folder\your_project_name.log

Création du projet : DemoAuto
Liste des projets du serveur

WorkItemTyp Store       AreaRootNod IterationRo          Id Name        Uri         StoredQueri HasWorkItem HasWorkItem
es                      es          otNodes                                         es           ReadRights WriteRights
----------- -----       ----------- -----------          -- ----        ---         ----------- ----------- -----------
{Bug, Ta... Microsof... {}          {Iterati...          13 Demo23      vstfs://... {Active ...        True        True
{Bug, Ta... Microsof... {}          {Iterati...         109 DemoAuto    vstfs://... {Active ...        True        True
{Bug, Ta... Microsof... {}          {Iterati...          20 MyDemo      vstfs://... {Active ...        True        True
{Bug, Ta... Microsof... {}          {Iterati...           7 Test        vstfs://... {Active ...        True        True
{Bug, Ta... Microsof... {}          {Iterati...           1 VSTS.Noham  vstfs://... {Active ...        True        True

Début de l'ajout des utilisateurs suivant
Antonin|Contributors;Project Administrators
Noham|Project Administrators
Noham is add in Contributors
Choulant is add in Contributors
Antonin is add in Contributors
Antonin is add in Project Administrators
Noham is add in Project Administrators
Comptes créés
Début de l'ajout de la branche de base
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Get-WIs.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Get-WIQueries.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Get-WI.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Get-TFS.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Get-ProjectMember.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Get-PendingStatus.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Get-Changeset.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Get-AllProjects.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Add-Project.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Add-MemberProject.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Add-Label.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Add-Files.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.CmdLet\Add-Branch.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\PsTFS.CmdLet\obj\Release\PsTFS.CmdLet.cspro
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\PsTFS\PsTFSHost.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\obj\Release\PsTFS.pdb, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\obj\Release\PsTFS.exe, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\obj\Debug\PsTFS.pdb, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\obj\Debug\PsTFS.exe, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\obj\Debug\PsTFS.csproj.FileListAbsolute.txt
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\bin\Debug\PsTFS.vshost.exe, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\bin\Debug\PsTFS.pdb, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\bin\Debug\PsTFS.exe, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\bin\Debug\Microsoft.TeamFoundation.WorkItem
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\PsTFS.vssscc, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\PsTFS.csproj.vspscc, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\PsTFS.csproj, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\PsTFS.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\MyRawUserInterface.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\MyHostUserInterface.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\MyHost.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS\AssemblyInfo.cs, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.vssscc, change: add
  path: c:\temp\MergeTFSPsTFS\a5467e1d-c35a-4c90-87b9-65a8200e3aeb\Dev\PsTFS.sln, change: add
Checked in changeset 65
Fichier ajouté
Successfully created label Branche DEV

Label                                   Scope                                                                    Status
-----                                   -----                                                                    ------
Branche DEV                             $/DemoAuto                                                              Created
Création de la branche DEV
Checked in changeset 66
Création de la branche RELEASE
Checked in changeset 67

Last edited Jan 10, 2009 at 8:28 PM by pc152, version 1


zedhex Jan 26, 2011 at 12:23 PM 
Can we have this in English please? (yes, I know I am a dumb mono-lingual anglo....)