0

How to use TF history command line on tfs 2013 build server?

when I try to call command line tf history C:\Builds\1\MyProj\MyBuild\src\Dev on tfs build server I get:

There is no working folder mapping for "C:\Builds\1\MyProj\MyBuild\src\Dev`

When I try powershell Get-TfsItemHistory C:\Builds\1\MyProj\MyBuild\src\Dev on tfs 2013 build server, I get:

Unable to determine the source control server.

When I open visual studio on build server and in Team Explorer I try to configure workspace mapping to the folder , I get:

"The working folder C:\Builds\1\MyProj\MyBuild\src\Dev is already in use by the workspace 10_1_MHATFSBLD01;MHABLDSvc on computer MHATFSBLD01."

*MHA is name of team project collection

Liero
  • 25,216
  • 29
  • 151
  • 297
  • are you logged on to the machine as yourself or the service account that the build agent runs under? – James Reed Feb 08 '16 at 14:56
  • I've got this message in both cases, from build log produced by build agent running as service account and when trying to run the script manually from my account – Liero Feb 09 '16 at 07:30

1 Answers1

1

Regarding the "no working folder error", you need to set the server:

 $tfs = get-tfsserver "http://server:8080/tfs/collection"
 Get-TfsItemHistory '$/YourTeamProject/MyProj/src/Dev' -Server $tfs

Obviously, you will need to adjust this for your specific TFS source structure.

Regarding the issue with the build not recognizing the TFS cmdlets, try your command in the Windows PowerShell x86 command prompt on the build agent. If it still fails you need to install the TFS cmdlets and/or fix PowerShell to run in 32 bit mode. See stackoverflow.com/questions/35292971

Community
  • 1
  • 1
chief7
  • 14,263
  • 14
  • 47
  • 80
  • `PS C:\Users\localuser> Get-TfsItemHistory $/MyTeamProj/Folder` -> Unable to determine the source control server. – Liero Feb 09 '16 at 09:57
  • Updated answer: need to set the tfs server. See above. – chief7 Feb 09 '16 at 11:31
  • I still have problem to run it from tfs build, since the powershell script running under service account cannot recognize the tfs cmdlets from tfs powertools, see http://stackoverflow.com/questions/35292971/tfs-build-microsoft-teamfoundation-powershell-is-not-installed-on-this-comput – Liero Feb 09 '16 at 13:18
  • Did you make sure the TFS PowerShell module is installed in both 32 and 64 bit? – chief7 Feb 09 '16 at 14:16
  • I don't know how to install it in 32bit... I've tried this http://stackoverflow.com/a/20642500/475727, but it does not work – Liero Feb 09 '16 at 14:20
  • Are you sure you are installing it on the build agent. There is a build server and build agents. – chief7 Feb 09 '16 at 14:29
  • The build log will list the agent. Double check you have installed on the right server. Also try running the PowerShell script in the Windows PowerShell x86 command prompt to see if you get the same error. – chief7 Feb 09 '16 at 14:53
  • It did not worked with `Windows PowerShell x86 command prompt`. I fixed that by editing registry, see http://stackoverflow.com/questions/35292971/tfs-build-microsoft-teamfoundation-powershell-is-not-installed-on-this-comput @chief7: Update your anser with this link, please, so it will be complete answer for future readers. – Liero Feb 09 '16 at 16:53
  • Answer edited. It might be helpful to edit your question as well to more clearly define questions for future readers. – chief7 Feb 09 '16 at 17:05