Add-Files

Introduction

"Add-Files" cmdlet allows to add files to a Team Foundation Server projet folder. It also can add reccursively a local folder content to the TFS Project. With this CmdLlet, you can automate project architecture deployment on creation. Here is Creation and automation sample of a new project.

Obtain the TFS server using the Get-TFS CmdLet.

Parameters

Name Description Example
-tfs TFS server obtained using Get-TFS $tfs = Get-TFS -rul http://address:8080
-ProjectName Project Name
-source source Folder from which files will be added c:\Temp\Modele
-description Enables to annotate the add files changeset.
-recursion Enables files of sub-folders to be added
-detail Enables the verbose mode

Adding file sample

========================================================
Windows PowerShell
PowerShell for Team System
By Noham Choulant http://choulant.blogspot.com
========================================================

PsTFS > : $tfs = get-tfs http://colmar:8080

PsTFS > : add-file -tfs $tfs -NameProject Test -source C:\Users\Administrateur\Desktop\PowerShell\ExemplePsTFS.txt -description "Ajout de fichier"

Pending add on c:\temp\MergeTFSPsTFS\daa6edbf-7456-4b65-a5d4-a564d66a91a8\TestExemplePsTFS.txt

Your current pending changes:
  path: c:\temp\MergeTFSPsTFS\daa6edbf-7456-4b65-a5d4-a564d66a91a8\TestExemplePsTFS.txt, change: add

Checking in c:\temp\MergeTFSPsTFS\daa6edbf-7456-4b65-a5d4-a564d66a91a8\TestExemplePsTFS.txt
Checked in changeset 16

PsTFS > :

Adding Many files

File list is a semi-colon separated list (;)


PsTFS > : $tfs = get-tfs http://colmar:8080

PsTFS > : add-file -tfs $tfs -NameProject Test -source "C:\Users\Administrateur\Desktop\PowerShell\ExemplePsTFSProjectWI.txt;C:\Users\Administrateur\D
esktop\PowerShell\ExemplePsTFSGroups.txt" -description "Ajout de plusieurs fichiers"

Pending add on c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSProjectWI.txt
Pending add on c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSProjectWI.txt
Pending add on c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSProjectWI.txt
Pending add on c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSProjectWI.txt
Pending add on c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSGroups.txt
Pending add on c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSGroups.txt
Pending add on c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSGroups.txt
Pending add on c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSGroups.txt
Your current pending changes:
  path: c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSGroups.txt, change: add
  path: c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSProjectWI.txt, change: add
Checking in c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSGroups.txt
Checking in c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSGroups.txt
Checking in c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSGroups.txt
Checking in c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSGroups.txt
Checking in c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSProjectWI.txt
Checking in c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSProjectWI.txt
Checking in c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSProjectWI.txt
Checking in c:\temp\MergeTFSPsTFS\a6cc0165-257a-4088-a54f-0d0845b058db\TestExemplePsTFSProjectWI.txt
Checked in changeset 18

Adding folder and its content



PsTFS > : $tfs = get-tfs http://colmar:8080

PsTFS > : add-files -tfs $tfs -NameProject Test/sub2/ -source "C:\Users\Administrateur\Desktop\PowerShell\" -description "Adding a folder"

Pending add on c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFS.txt
Pending add on c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSAddFile.txt
Pending add on c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSAddFiles.txt
Pending add on c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSAddMembers.txt
Pending add on c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSGroups.txt
Pending add on c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSProjectWI.txt
Pending add on c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSProjectWI2.txt
Pending add on c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSRemoveMembers.txt
Pending add on c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\Get-tfs.ps1
Pending add on c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\Powershell.pptx
Pending add on c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\users.txt
Your current pending changes:
  path: c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\users.txt, change: add
  path: c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\Powershell.pptx, change: add
  path: c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\Get-tfs.ps1, change: add
  path: c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSRemoveMembers.txt, change: add
  path: c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSProjectWI2.txt, change: add
  path: c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSProjectWI.txt, change: add
  path: c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSGroups.txt, change: add
  path: c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSAddMembers.txt, change: add
  path: c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSAddFiles.txt, change: add
  path: c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSAddFile.txt, change: add
  path: c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFS.txt, change: add
Checking in c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFS.txt
Checking in c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSAddFile.txt
Checking in c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSAddFiles.txt
Checking in c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSAddMembers.txt
Checking in c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSGroups.txt
Checking in c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSProjectWI.txt
Checking in c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSProjectWI2.txt
Checking in c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\ExemplePsTFSRemoveMembers.txt
Checking in c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\Get-tfs.ps1
Checking in c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\Powershell.pptx
Checking in c:\temp\MergeTFSPsTFS\5b4b3656-dd1e-4592-bcd8-b6b6c056a6d0\Test\sub2\users.txt
Checked in changeset 20

Last edited Nov 8, 2009 at 9:44 AM by pc152, version 8

Comments

estump Apr 28, 2009 at 11:14 PM 
Something is wrong with the Add-Files cmdlet - when I try to get help for it, I get the help for get-tfs cmdlet.
Looks like all of these cmdlts use the get-tfs help
Also, it does not recognize all of its parameters -projectname, description...
Do I have the correct installation files - version 0.3.2.0?

estump