Download files from TFS server with PowerShell

If you want to download files from TFS with PowerShell, you will need to write a script that can access the TFS Server and access the folder on your drive.

This script uses a server path in the TFS server and download some files under that server path to the drop folder of your build. If you don’t use a build, you can change then environment variables. This script is created because of an original question on StackOverflow.

 

3 thoughts to “Download files from TFS server with PowerShell”

  1. Need help ,

    I am using a network path for the variable $destinationPath and getting the below error.
    WARNING: Exception CategoryInfo : Exception calling “DownloadFile” with “2” argument(s): “The network path was not found”.Exception ..

    i used a localhost to D:drive ,
    Adding PowerShell Snap-in
    Finished Adding PowerShell Snap-in
    Download to \\LOCALHOST\d$\rops\Refresh
    Download to \\LOCALHOST\d$\rops\Refresh\xxxxxx.ps1

    Thank You

    1. Does it work if you don’t change the code? If so, you know that the path is the real problem. Don’t forget to set the security of the path. What is localhost? Localhost must be your pc. The TFS server needs to know what your pc is and the folder must be shared with it.

Leave a Reply